public ActionResult AddTask(TaskViewModel item, int Id)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var Task = new TaskN()
             {
                 TaskId = item.TaskId, TaskName = item.TaskName, TaskDescription = item.TaskDescription, TaskStartDate = item.TaskStartDate, TaskEndDate = item.TaskEndDate, TaskStatus = item.TaskStatus, ProjectId = Id, EmployeeId = item.EmployeeId
             };
             var Added = TaskRepo.Add(Task);
             if (Added)
             {
                 return(RedirectToAction("DisplayProjectTask" + "/" + Id));
             }
             else
             {
                 ModelState.AddModelError("", "Failed to add");
                 return(View());
             }
         }
         else
         {
             ModelState.AddModelError("", "One or More validation failed");
             return(View());
         }
     }
     catch (ProjectManagerException e)
     {
         return(Content("Error" + e.Message));
     }
 }
Exemplo n.º 2
0
 public bool AddTask(TaskN proj)
 {
     try
     {
         return(TaskRepo.Add(proj));
     }
     catch (ProjectManagerException e)
     {
         throw e;
     }
 }