public IActionResult Add(Category category) { if (!ModelState.IsValid) { return(BadRequest()); } context.Entry <Category>(category).State = Microsoft.EntityFrameworkCore.EntityState.Added; context.SaveChanges(); return(Ok()); }
public IActionResult Edit(Product product) { //if (id != product.Id) return BadRequest(); context.Entry(product).State = EntityState.Modified; context.SaveChanges(); return(Ok()); }