// Helper method to build tasks easily for testing by calling Build_Task_For_Testing private TaskModel Build_Task_For_Testing(string header, DateTime date, string desc, string username) { TaskModel buildTask = new TaskModel(); buildTask.TaskHeader = header; buildTask.Deadline = date; buildTask.Username = username; return buildTask; }
public ActionResult Create(TaskModel taskmodel) { if (taskmodel.Username == null && User.Identity.Name != "") { taskmodel.Username = User.Identity.Name; } else { return RedirectToAction("Index"); } if (ModelState.IsValid) { db.Tasks.Add(taskmodel); db.SaveChanges(); return RedirectToAction("Index"); } return View(taskmodel); }
public void MarkAsModified(TaskModel task) { }
// Adds task to our test database // task: TaskModel object to be saved to our test database public TaskModel AddTask(TaskModel task) { var taskAdd = _context.Tasks.Add(task); _context.SaveChanges(); return taskAdd; }
public void MarkAsModified(TaskModel task) { Entry(task).State = System.Data.Entity.EntityState.Modified; }
public ActionResult Edit(TaskModel taskmodel) { if (ModelState.IsValid) { db.MarkAsModified(taskmodel); taskmodel.Username = User.Identity.Name; db.SaveChanges(); return RedirectToAction("Index"); } return View(taskmodel); }