Gossage dans API

This commit is contained in:
MarcEricMartel
2022-10-27 09:37:13 -07:00
parent 04c7d68a44
commit 83331a4a08
10 changed files with 213 additions and 39 deletions

View File

@@ -29,7 +29,7 @@ public class ProductController : ControllerBase {
}
[EnableCors("_myAllowSpecificOrigins"), HttpGet(Name = "Product"), AllowAnonymous]
public ActionResult<Product> Get(int id) {
public ActionResult<ProductViewModel> Get(int id) {
Product prod;
try {
prod = _context.Products.Where(x => x.Id == id).First();
@@ -38,7 +38,8 @@ public class ProductController : ControllerBase {
_logger.LogError(8, e.Message);
return NotFound();
}
return prod;
_cache.addHit((uint)id);
return new ProductViewModel(prod);
}
[EnableCors("_myAllowSpecificOrigins"), HttpPost(Name = "Product")]