Beispiel #1
0
 public ActionResult AddTask(int categoryId)
 {
     if (Session["LogedUserID"] != null)
     {
         var categoryTask = new CategoryTaskViewModel();
         categoryTask.CategoryId = categoryId;
         categoryTask.Task = new Task();
         return View(categoryTask);
     }
     else
     {
         return RedirectToAction("LoginAccount", "Account");
     }
 }
Beispiel #2
0
 public ActionResult AddTask(CategoryTaskViewModel categoryTask)
 {
     if (ModelState.IsValid)
     {
         try
         {
             taskService.Add(categoryTask.CategoryId, categoryTask.Task);
             taskService.Save();
         }
         catch (DbUpdateException)
         {
             return RedirectToAction("ShowError", "Error");
         }
         return RedirectToAction("ShowTasks", new { categoryId = categoryTask.CategoryId});
     }
     else
     {
         return View(categoryTask);
     }
 }