Пример #1
0
 public ActionResult AddTaskItem(int taskId)
 {
     if (Session["LogedUserID"] != null)
     {
         var taskTaskItem = new TaskTaskItemViewModel();
         taskTaskItem.TaskId = taskId;
         taskTaskItem.Task = new TaskItem();
         return View(taskTaskItem);
     }
     else
     {
         return RedirectToAction("LoginAccount", "Account");
     }
 }
Пример #2
0
 public ActionResult AddTaskItem(TaskTaskItemViewModel taskTaskItem)
 {
     if (ModelState.IsValid)
     {
         try
         {
             taskItemService.Add(taskTaskItem.TaskId, taskTaskItem.Task);
             taskItemService.Save();
         }
         catch (DbUpdateException)
         {
             return RedirectToAction("ShowError", "Error");
         }
         return RedirectToAction("ShowTaskItems", new { taskId = taskTaskItem.TaskId });
     }
     else
     {
         return View(taskTaskItem);
     }
 }