2022-07-25 17:02:36 +02:00
|
|
|
|
using Microsoft.AspNet.Identity;
|
|
|
|
|
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
|
|
|
|
|
{
|
2022-08-06 16:21:52 +02:00
|
|
|
|
|
2022-07-25 17:02:36 +02:00
|
|
|
|
public class SaleController : ApiController
|
|
|
|
|
{
|
2022-08-06 16:21:52 +02:00
|
|
|
|
[Authorize(Roles = "Cashier")]
|
2022-07-25 17:02:36 +02:00
|
|
|
|
public void Post(SaleModel sale)
|
|
|
|
|
{
|
|
|
|
|
string cashierId = RequestContext.Principal.Identity.GetUserId();
|
|
|
|
|
SaleData data = new SaleData();
|
|
|
|
|
|
|
|
|
|
data.SaveSale(sale, cashierId);
|
|
|
|
|
}
|
2022-08-02 19:32:39 +02:00
|
|
|
|
|
2022-08-06 16:21:52 +02:00
|
|
|
|
[Authorize(Roles = "Admin,Manager")]
|
2022-08-02 19:32:39 +02:00
|
|
|
|
[Route("GetSalesReport")]
|
|
|
|
|
public List<SaleReportModel> GetSalesReport()
|
|
|
|
|
{
|
|
|
|
|
SaleData data = new SaleData();
|
|
|
|
|
|
|
|
|
|
return data.GetSaleReport();
|
|
|
|
|
}
|
2022-07-25 17:02:36 +02:00
|
|
|
|
}
|
|
|
|
|
}
|