Retail_manager/RMDataManager/Controllers/InventoryController.cs
s459315 35c5e1af28 Added Roles
Added role based authentication to contollers
2022-08-06 16:21:52 +02:00

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