BotSharp/BotSharp.RestApi/EntityTypeController.cs
haiping008@gmail.com 6c472545c0 Rename project
2018-03-28 17:08:49 -05:00

32 lines
903 B
C#

using BotSharp.Core.Agents;
using BotSharp.Core.Entities;
using EntityFrameworkCore.BootKit;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.Core.RestApi
{
public class EntityTypeController : EssentialController
{
[HttpPost]
public string CreateType([FromBody] Entity entityType)
{
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();
}
}
}