public ActionResult Create(Allergies model) { try { var obj = new Allergies() { Allergy = model.Allergy }; db.tabAllergies.Add(obj); db.SaveChanges(); return null; } catch (Exception ex) { throw ex; } }
public ActionResult Edit(Allergies model) { try { Allergies allergies = db.tabAllergies.Find(model.AllergyId); allergies.Allergy = model.Allergy; db.Entry(allergies).State = EntityState.Modified; db.SaveChanges(); return PartialView("Create"); } catch (Exception) { throw; } }