2018-01-02 18:05:35 +00:00
|
|
|
|
using Bot.Rasa.Agents;
|
|
|
|
|
|
using Bot.Rasa.Entities;
|
|
|
|
|
|
using EntityFrameworkCore.BootKit;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bot.Rasa.RestApi
|
|
|
|
|
|
{
|
|
|
|
|
|
public class EntityTypeController : EssentialController
|
|
|
|
|
|
{
|
|
|
|
|
|
[HttpPost]
|
2018-03-21 21:07:43 +00:00
|
|
|
|
public string CreateType([FromBody] Entity entityType)
|
2018-01-02 18:05:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
var agent = dc.Table<Agent>().Find(entityType.AgentId);
|
|
|
|
|
|
dc.DbTran(() => agent.CreateEntityType(dc, entityType));
|
|
|
|
|
|
|
|
|
|
|
|
return entityType.Id;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpDelete("{agentId}/{entityTypeId}")]
|
|
|
|
|
|
public IActionResult DeleteType([FromRoute] String agentId, [FromRoute] String entityTypeId)
|
|
|
|
|
|
{
|
|
|
|
|
|
var agent = dc.Table<Agent>().Find(agentId);
|
|
|
|
|
|
dc.DbTran(() => agent.DeleteEntityType(dc, entityTypeId));
|
|
|
|
|
|
|
|
|
|
|
|
return Ok();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|