public int InsertCategory(Category category) { context.Categories.Add(category); context.SaveChanges(); return category.Id; }
public void UpdateCategory(Category category) { Category dbCategory = context.Categories.Find(category.Id); if (dbCategory != null) { dbCategory.Name = category.Name; context.SaveChanges(); } }