Skip to content

Commit

Permalink
Merge pull request #831 from mikecasas/master
Browse files Browse the repository at this point in the history
Update template to use the new constants.
  • Loading branch information
sbwalker authored Oct 19, 2020
2 parents c733707 + 1315e03 commit 3b09699
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace [Owner].[Module].Controllers
{
[Route("{alias}/api/[controller]")]
[Route(ControllerRoutes.Default)]
public class [Module]Controller : Controller
{
private readonly I[Module]Repository _[Module]Repository;
Expand All @@ -30,15 +30,15 @@ public [Module]Controller(I[Module]Repository [Module]Repository, ILogManager lo

// GET: api/<controller>?moduleid=x
[HttpGet]
[Authorize(Policy = "ViewModule")]
[Authorize(Policy = PolicyNames.ViewModule)]
public IEnumerable<Models.[Module]> Get(string moduleid)
{
return _[Module]Repository.Get[Module]s(int.Parse(moduleid));
}

// GET api/<controller>/5
[HttpGet("{id}")]
[Authorize(Policy = "ViewModule")]
[Authorize(Policy = PolicyNames.ViewModule)]
public Models.[Module] Get(int id)
{
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
Expand All @@ -51,7 +51,7 @@ public Models.[Module] Get(int id)

// POST api/<controller>
[HttpPost]
[Authorize(Policy = "EditModule")]
[Authorize(Policy = PolicyNames.EditModule)]
public Models.[Module] Post([FromBody] Models.[Module] [Module])
{
if (ModelState.IsValid && [Module].ModuleId == _entityId)
Expand All @@ -64,7 +64,7 @@ public Models.[Module] Post([FromBody] Models.[Module] [Module])

// PUT api/<controller>/5
[HttpPut("{id}")]
[Authorize(Policy = "EditModule")]
[Authorize(Policy = PolicyNames.EditModule)]
public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module])
{
if (ModelState.IsValid && [Module].ModuleId == _entityId)
Expand All @@ -77,7 +77,7 @@ public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module])

// DELETE api/<controller>/5
[HttpDelete("{id}")]
[Authorize(Policy = "EditModule")]
[Authorize(Policy = PolicyNames.EditModule)]
public void Delete(int id)
{
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
Expand Down

0 comments on commit 3b09699

Please sign in to comment.