public ActionResult DeleteConfirmed(int id) { CouresModel couresModel = db.Course.Find(id); db.Course.Remove(couresModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Title,Credits")] CouresModel couresModel) { if (ModelState.IsValid) { db.Entry(couresModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(couresModel)); }
public ActionResult Create([Bind(Include = "ID,Title,Credits")] CouresModel couresModel) { if (ModelState.IsValid) { db.Course.Add(couresModel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(couresModel)); }
// GET: Coures/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CouresModel couresModel = db.Course.Find(id); if (couresModel == null) { return(HttpNotFound()); } return(View(couresModel)); }