public ActionResult Create(Task task) { if (ModelState.IsValid) { task.UserId = WebSecurity.GetUserId(User.Identity.Name); task.IsComplete = false; _context.Task.InsertOnSubmit(task); _context.SubmitChanges(); return RedirectToAction("Index"); } return View(task); }
partial void DeleteTask(Task instance);
partial void UpdateTask(Task instance);
partial void InsertTask(Task instance);
public ActionResult Edit(Task task) { if (ModelState.IsValid) { Task findTask = _context.Task.SingleOrDefault(t => t.TaskId.Equals(task.TaskId)); findTask.Title = task.Title; findTask.Content = task.Content; findTask.Level = task.Level; findTask.IsComplete = task.IsComplete; _context.SubmitChanges(); return RedirectToAction("Index"); } return View(task); }