예제 #1
0
 // 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;
 }
예제 #2
0
        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);
        }
예제 #3
0
 public void MarkAsModified(TaskModel task)
 {
 }
예제 #4
0
 // 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;
 }
예제 #5
0
 public void MarkAsModified(TaskModel task)
 {
     Entry(task).State = System.Data.Entity.EntityState.Modified;
 }
예제 #6
0
 public ActionResult Edit(TaskModel taskmodel)
 {
     if (ModelState.IsValid)
     {
         db.MarkAsModified(taskmodel);
         taskmodel.Username = User.Identity.Name;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(taskmodel);
 }