BootstrapAdmin11/Bootstrap.Admin/Controllers/GroupsController.cs

50 lines
1.3 KiB
C#
Raw Normal View History

using Bootstrap.Admin.Models;
using Bootstrap.DataAccess;
using System.Linq;
using System.Web.Http;
namespace Bootstrap.Admin.Controllers
{
public class GroupsController : ApiController
{
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
[HttpGet]
public QueryData<Group> Get([FromUri]QueryGroupOption value)
{
return value.RetrieveData();
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public Group Get(int id)
{
return GroupHelper.RetrieveGroups().FirstOrDefault(t => t.ID == id);
}
/// <summary>
///
/// </summary>
/// <param name="value"></param>
[HttpPost]
public bool Post([FromBody]Group value)
{
return GroupHelper.SaveGroup(value);
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
[HttpDelete]
public bool Delete([FromBody]string value)
{
return GroupHelper.DeleteGroup(value);
}
}
}