created/padded out the GroupController to simply Get and Create groups.
#59
This commit is contained in:
parent
b4eb179c8f
commit
cf3a099314
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Web.Http;
|
||||||
|
using Interfaces;
|
||||||
|
|
||||||
|
namespace WindowsDataCenter
|
||||||
|
{
|
||||||
|
[RoutePrefix("api/groups")]
|
||||||
|
public class GroupController:ApiController
|
||||||
|
{
|
||||||
|
private IRepository _repo;
|
||||||
|
public GroupController(IRepository repo)
|
||||||
|
{
|
||||||
|
if(repo == null) throw new ArgumentNullException(nameof(repo));
|
||||||
|
_repo = repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("")]
|
||||||
|
public IHttpActionResult GetGroups()
|
||||||
|
{
|
||||||
|
var groups = _repo.GetGroups();
|
||||||
|
return Ok(groups);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[Route("create")]
|
||||||
|
public IHttpActionResult CreateGroup([FromBody] Group group)
|
||||||
|
{
|
||||||
|
var groupId = -1;
|
||||||
|
var resp = _repo.CreateGroup(group, out groupId);
|
||||||
|
|
||||||
|
return Ok(groupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user