35c5e1af28
Added role based authentication to contollers
29 lines
718 B
C#
29 lines
718 B
C#
using RMDataManagerLibrary.DataAcccess;
|
|
using RMDataManagerLibrary.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Web.Http;
|
|
|
|
namespace RMDataManager.Controllers
|
|
{
|
|
|
|
public class InventoryController : ApiController
|
|
{
|
|
[Authorize(Roles = "Admin,Manager")]
|
|
public List<InventoryModel> Get()
|
|
{
|
|
InventoryData data = new InventoryData();
|
|
return data.GetInventory();
|
|
}
|
|
[Authorize(Roles = "Admin")]
|
|
public void Post(InventoryModel item)
|
|
{
|
|
InventoryData data = new InventoryData();
|
|
data.SaveInventoryRecord(item);
|
|
}
|
|
}
|
|
}
|