public ActionResult Create(GlossaryMain glossary) { try { using (GlossaryDBEntities gEntity = new GlossaryDBEntities()) { gEntity.GlossaryMains.Add(glossary); gEntity.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, GlossaryMain glossary) { try { using (GlossaryDBEntities gEntity = new GlossaryDBEntities()) { gEntity.Entry(glossary).State = EntityState.Modified; gEntity.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { using (GlossaryDBEntities gEntity = new GlossaryDBEntities()) { GlossaryMain gMain = gEntity.GlossaryMains.Where(x => x.Id == id).FirstOrDefault(); gEntity.GlossaryMains.Remove(gMain); gEntity.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }