created/padded out the GroupController to simply Get and Create groups.

#59
This commit is contained in:
Chris.Watts90@outlook.com 2017-03-08 16:28:06 +00:00
parent b4eb179c8f
commit cf3a099314

View File

@ -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);
}
}
}