Tuer des bébés
This commit is contained in:
@@ -5,6 +5,7 @@ using GrossesMitainesAPI.Data;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
|
||||
namespace GrossesMitainesAPI.Controllers;
|
||||
|
||||
@@ -18,6 +19,7 @@ public class ProductController : Controller {
|
||||
_context = context;
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins")]
|
||||
[HttpGet(Name = "Product"), AllowAnonymous]
|
||||
public Product Get(int id) {
|
||||
Product prod;
|
||||
@@ -30,6 +32,7 @@ public class ProductController : Controller {
|
||||
return prod;
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins")]
|
||||
[HttpPost(Name = "Product")]
|
||||
public void Post(string title, string category, string description, decimal? price, decimal? promoprice, uint? quantity, string? status, string imagename) {
|
||||
Product prod = new() {
|
||||
@@ -75,6 +78,7 @@ public class ProductController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins")]
|
||||
[HttpPut(Name = "Product")]
|
||||
public void Put(int id, string title, string category, string description, decimal? price, decimal? promoprice, uint? quantity, string? status, string imagename) {
|
||||
Product prod = _context.Products.Where(x => x.Id == id).FirstOrDefault();
|
||||
@@ -132,6 +136,7 @@ public class ProductController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins")]
|
||||
[HttpPatch(Name = "Product")]
|
||||
public void Patch(int id, string title, string category, string description, decimal? price, decimal? promoprice, uint? quantity, string? status, string imagename) {
|
||||
try {
|
||||
@@ -187,6 +192,7 @@ public class ProductController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
[EnableCors("_myAllowSpecificOrigins")]
|
||||
[HttpDelete(Name = "Product")]
|
||||
public void DeleteProduct(int id) {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user