public ActionResult Create(Task task) { if (ModelState.IsValid) { task.goalid = Convert.ToInt32(TempData["Goalid"]); db.Tasks.Add(task); db.SaveChanges(); return RedirectToAction("Index"); } return View(task); }
public ActionResult Edit(Task task) { if (ModelState.IsValid) { db.Entry(task).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(task); }