Exemple #1
0
 public static TaskEntity ToBLL(TaskModel task)
 {
     return new TaskEntity{
         Id = task.Guid,
         Description = task.Description,
         Title = task.Title
     };
 }
 public ActionResult EditTask(TaskModel task)
 {
     ActionResult result = RedirectToAction("_EditTask", task);
     if (ModelState.IsValid)
     {
         taskService.Edit(TaskMapper.ToBLL(task));
         result = RedirectToAction("Index", "TaskEditor", new { message = "Task updated" });
     }
     return result;
 }
 public ActionResult CreateTask(TaskModel model)
 {
     ActionResult result = View();
     if (ModelState.IsValid)
     {
         model.Guid = Guid.NewGuid();
         taskService.Add(TaskMapper.ToBLL(model));
         result = RedirectToAction("Index", "TaskEditor", new { message = "Task created" });
     }
     return result;
 }
 public void Post(TaskModel value)
 {
     if (value.Title == null) { }
     else {
         _tasks.Add(new TaskEntity()
         {
             Title = value.Title,
             IsCompleted = value.IsCompleted,
             FolderId = value.FolderId,
             PresentationPriority = _tasks.GetTaskList(value.FolderId).Count()
         });
     }
     return;
 }
 public ActionResult ViewTask(TaskModel task)
 {
     return View(task);
 }
 public void PostTask(TaskModel value)
 {
     var temp = _tasks.GetById(value.Id);
     var taskForUpdate = new TaskEntity()
     {
         Id = temp.Id,
         Description = (value.Description != null ? value.Description : temp.Description),
         FolderId = (value.FolderId != 0 ? value.FolderId : temp.FolderId),
         DueTime = (value.DueTime != null ? value.DueTime : temp.DueTime),
         IsCompleted = value.IsCompleted,
         Title = (value.Title != null ? value.Title : temp.Title)
     };
     _tasks.Edit(taskForUpdate);
 }