BootstrapAdmin/Bootstrap.Admin/Controllers/Api/DictsController.cs

48 lines
1.3 KiB
C#
Raw Normal View History

2018-06-07 00:45:47 +08:00
using Bootstrap.Admin.Query;
using Bootstrap.DataAccess;
using Bootstrap.Security;
using Longbow.Web.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
2018-06-08 12:54:05 +08:00
using System.Collections.Generic;
2018-06-07 00:45:47 +08:00
namespace Bootstrap.Admin.Controllers.Api
{
/// <summary>
///
/// </summary>
[Route("api/[controller]")]
public class DictsController : Controller
{
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
[HttpGet]
public QueryData<BootstrapDict> Get(QueryDictOption value)
{
return value.RetrieveData();
}
/// <summary>
///
/// </summary>
/// <param name="value"></param>
[HttpPost]
public bool Post([FromBody]BootstrapDict value)
{
return DictHelper.SaveDict(value);
}
/// <summary>
///
/// </summary>
/// <param name="value"></param>
[HttpDelete]
[Authorize(Roles = "Administrators")]
2018-06-08 20:13:52 +08:00
public object Delete([FromBody]IEnumerable<int> value)
2018-06-07 00:45:47 +08:00
{
var result = DictHelper.DeleteDict(value);
return new { result, msg = result ? "成功!" : "失败" };
}
}
}