public ActionResult Edit(ItemTypeModel itemTypeModel) { using (var necessitiesContext = new NecessitiesContext()) { var itemType = necessitiesContext.ItemTypes.First(x => x.ItemTypeId == itemTypeModel.ItemTypeId); itemType.Description = itemTypeModel.Description; itemType.Active = itemTypeModel.Active; necessitiesContext.SaveChanges(); } return RedirectToAction("Index"); }
public ActionResult Create(ItemTypeModel itemTypeModel) { using (var necessitiesContext = new NecessitiesContext()) { necessitiesContext.ItemTypes.Add( new ItemType { Description = itemTypeModel.Description, Active = true }); necessitiesContext.SaveChanges(); } return RedirectToAction("Index"); }