public ActionResult Create(Task task) { if (ModelState.IsValid) { db.Tasks.Add(task); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RequestId = new SelectList(db.Requests, "Id", "Name", task.RequestId); return View(task); }
public ActionResult Edit(Task task) { if (ModelState.IsValid) { db.Entry(task).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RequestId = new SelectList(db.Requests, "Id", "Name", task.RequestId); return View(task); }