public ActionResult DeleteConfirmed(int id) { Terms2 terms2 = db.Terms2.Find(id); db.Terms2.Remove(terms2); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,MOT_ID,Headword,Definition,Full_form,Abbreviations,Synonyms")] Terms2 terms2) { if (ModelState.IsValid) { db.Entry(terms2).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(terms2)); }
// GET: Terms2/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Terms2 terms2 = db.Terms2.Find(id); if (terms2 == null) { return(HttpNotFound()); } return(View(terms2)); }
public ActionResult Create([Bind(Include = "ID,MOT_ID,Headword,Definition,Full_form,Abbreviations,Synonyms")] Terms2 terms2) { if (ModelState.IsValid) { var isEmailAlreadyExists = db.Terms2.Any(x => x.MOT_ID == terms2.MOT_ID); if (isEmailAlreadyExists) { ModelState.AddModelError(string.Empty, "MOD ID is already exists"); return(View(terms2)); } db.Terms2.Add(terms2); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(terms2)); }