public void Post([FromBody] NewCategory NewCategory) { Category category = new Category(); category.Name = NewCategory.Name; category.Description = NewCategory.Description; ProdContext.Categories.Add(category); ProdContext.SaveChanges(); }
public void Put(int categoryId, [FromBody] NewCategory editedCategory) { Category toEdit = (from category in ProdContext.Categories where category.CategoryId == categoryId select category) .First(); toEdit.Name = editedCategory.Name; toEdit.Description = editedCategory.Description; ProdContext.SaveChanges(); }