public IActionResult GetAllProducts() { try { return(Ok(_mapper.ParseProduct(_productService.GetAllProducts()))); } catch (Exception) { return(BadRequest()); } }
public Model.Product AddProduct(Model.Product newProduct) { _context.Products.Add(_mapper.ParseProduct(newProduct)); _context.SaveChanges(); return(newProduct); }