argh.
This commit is contained in:
@@ -38,7 +38,7 @@ public class AddressController : Controller {
|
||||
#endregion
|
||||
|
||||
#region API Methods
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpGet(Name = "Addresses"), Route("ListAddresses")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpGet]
|
||||
public async Task<ActionResult<List<AddressModel>>> GetList(bool? all) {
|
||||
IList<string> roles;
|
||||
InventoryUser user;
|
||||
@@ -69,7 +69,7 @@ public class AddressController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpGet(Name = "Address")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpGet("{id}")]
|
||||
public async Task<ActionResult<AddressModel>> Get(int id) {
|
||||
IList<string> roles;
|
||||
string userId;
|
||||
@@ -103,7 +103,7 @@ public class AddressController : Controller {
|
||||
else return Unauthorized();
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpPost(Name = "Address")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpPost]
|
||||
public async Task<ActionResult<AddressModel>> Post(AddressModel ad) {
|
||||
try {
|
||||
var user = await _userMan.GetUserAsync(_signInMan.Context.User);
|
||||
@@ -117,7 +117,7 @@ public class AddressController : Controller {
|
||||
return ad;
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpPatch(Name = "Address")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpPatch]
|
||||
public async Task<ActionResult<AddressModel>> Patch(AddressModel ad) {
|
||||
IList<string> roles;
|
||||
InventoryUser user;
|
||||
@@ -149,7 +149,7 @@ public class AddressController : Controller {
|
||||
return ad;
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpDelete(Name = "Address")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpDelete]
|
||||
public async Task<ActionResult<int>> Delete(int id) {
|
||||
IList<string> roles;
|
||||
AddressModel ad;
|
||||
|
@@ -43,7 +43,7 @@ public class InvoiceController : Controller {
|
||||
#endregion
|
||||
|
||||
#region API Methods
|
||||
[HttpGet, Route("GetList"), Authorize(Roles = "Client, Administrateur")]
|
||||
[HttpGet, Authorize(Roles = "Client, Administrateur")]
|
||||
public async Task<ActionResult<List<InvoiceModel>>> Get(bool? all = false) {
|
||||
IList<string> roles;
|
||||
string id;
|
||||
@@ -67,7 +67,7 @@ public class InvoiceController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet, Route("Get"), Authorize(Roles = "Client, Administrateur")]
|
||||
[HttpGet("{id}"), Authorize(Roles = "Client, Administrateur")]
|
||||
public async Task<ActionResult<InvoiceModel>> Get(int id) {
|
||||
IList<string> roles;
|
||||
InvoiceModel inv;
|
||||
@@ -166,7 +166,7 @@ public class InvoiceController : Controller {
|
||||
return Ok(inv);
|
||||
}
|
||||
|
||||
[HttpPost, Route("CancelInvoice"), Authorize(Roles = "Client, Administrateur")]
|
||||
[HttpPost("Cancel/{id}"), Authorize(Roles = "Client, Administrateur")]
|
||||
public async Task<ActionResult<InvoiceModel>> Cancel(int id) {
|
||||
InvoiceModel inv;
|
||||
IList<string> roles;
|
||||
|
@@ -13,6 +13,7 @@ using GrossesMitainesAPI.Services;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
@@ -44,12 +45,12 @@ public class ProductController : ControllerBase {
|
||||
#endregion
|
||||
|
||||
#region API Methods
|
||||
[EnableCors("_myAllowSpecificOrigins"), Route("Quantity"), HttpGet(Name = "Product"), AllowAnonymous]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpGet("Quantity"), AllowAnonymous]
|
||||
public ActionResult<uint> ProdCount(int id) {
|
||||
return _context.Products.FirstOrDefault(x => x.Id == id).Quantity;
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpGet(Name = "Product"), AllowAnonymous]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpGet(), AllowAnonymous]
|
||||
public ActionResult<ProductViewModel> Get(int id) {
|
||||
ProductModel prod;
|
||||
try {
|
||||
@@ -63,7 +64,7 @@ public class ProductController : ControllerBase {
|
||||
return new ProductViewModel(prod);
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpPost(Name = "Product")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpPost()]
|
||||
public async Task<ActionResult<ProductModel>> Post([FromForm] ProductModel prod) {
|
||||
if (prod.Price <= prod.PromoPrice)
|
||||
prod.PromoPrice = prod.Price - 0.01M;
|
||||
@@ -82,7 +83,7 @@ public class ProductController : ControllerBase {
|
||||
return prod;
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpPatch(Name = "Product")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpPatch()]
|
||||
public async Task<ActionResult<ProductModel>> Patch([FromForm] ProductModel prod) {
|
||||
string? oldImage = "";
|
||||
try {
|
||||
@@ -106,7 +107,7 @@ public class ProductController : ControllerBase {
|
||||
return prod;
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpDelete(Name = "Product")]
|
||||
[EnableCors("_myAllowSpecificOrigins"), HttpDelete()]
|
||||
public ActionResult<int> Delete(int id) {
|
||||
try {
|
||||
var prod = _context.Products.Where(x => x.Id == id).First();
|
||||
|
Reference in New Issue
Block a user