public async Task <ActionResult> DeleteConfirmed(int id) { Сourse Course = await db.Сourse.FindAsync(id); db.Сourse.Remove(Course); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,TeacherID")] Сourse Course) { if (ModelState.IsValid) { db.Entry(Course).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.TeacherID = new SelectList(db.Teacher, "Id", "Name", Course.TeacherID); return(View(Course)); }
// GET: Сourse/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Сourse Course = await db.Сourse.FindAsync(id); if (Course == null) { return(HttpNotFound()); } return(View(Course)); }
// GET: Сourse/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Сourse Course = await db.Сourse.FindAsync(id); if (Course == null) { return(HttpNotFound()); } ViewBag.TeacherID = new SelectList(db.Teacher, "Id", "Name", Course.TeacherID); return(View(Course)); }