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

48 lines
1.2 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]")]
[ApiController]
public class DictsController : ControllerBase
2018-06-07 00:45:47 +08:00
{
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
[HttpGet]
public QueryData<BootstrapDict> Get([FromQuery]QueryDictOption value)
2018-06-07 00:45:47 +08:00
{
return value.RetrieveData();
}
/// <summary>
///
/// </summary>
/// <param name="value"></param>
[HttpPost]
public bool Post([FromBody]BootstrapDict value)
{
return DictHelper.Save(value);
2018-06-07 00:45:47 +08:00
}
/// <summary>
///
/// </summary>
/// <param name="value"></param>
[HttpDelete]
[Authorize(Roles = "Administrators")]
2018-10-30 13:07:29 +08:00
public bool Delete([FromBody]IEnumerable<string> value)
2018-06-07 00:45:47 +08:00
{
return DictHelper.Delete(value);
2018-06-07 00:45:47 +08:00
}
}
}