Esempio n. 1
0
 public ActionResult DeleteSubtask(TrackingTaskViewModel taskModel)
 {
     try
     {
         var deletedTask = Mapper.Map <TrackingTaskViewModel, TrackingTask>(taskModel);
         businessLogic.Delete(deletedTask.Id);
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         return(View(e.Message));
     }
 }
Esempio n. 2
0
        public ActionResult Create(TrackingTaskViewModel taskModel)
        {
            var task = Mapper.Map <TrackingTaskViewModel, TrackingTask>(taskModel);

            try
            {
                businessLogic.Add(task);
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View(e.Message));
            }
        }
Esempio n. 3
0
 public ActionResult CreateSubTask(int id)
 {
     //ViewBag.ProgressList = CreateProgressList();
     try
     {
         var createdTask = Mapper.Map <TrackingTask, TrackingTaskViewModel>(businessLogic.GetById(id));
         TrackingTaskViewModel subtask = new TrackingTaskViewModel();
         subtask.ParentId               = createdTask.Id;
         subtask.ProjectName            = createdTask.ProjectName;
         subtask.ApplicationUserDetails = createdTask.ApplicationUserDetails;
         return(View(subtask));
     }catch (Exception e)
     {
         return(View(e.Message));
     }
 }
Esempio n. 4
0
        public async Task <ActionResult> AssignUser(TrackingTaskViewModel taskModel)
        {
            try
            {
                var task = Mapper.Map <TrackingTaskViewModel, TrackingTask>(taskModel);
                foreach (var user in UserManager.Users.ToList())
                {
                    if (user.Id == task.UserId)
                    {
                        task.ApplicationUserDetails = user.FullName + " " + user.Surname;
                        break;
                    }
                }
                businessLogic.Update(task);
                await UserManager.SendEmailAsync(task.UserId, "You were assigned to task ",
                                                 "Please login to system to see the details. Your project is " + task.ProjectName + ",your task is " + task.TaskName);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View(e.Message));
            }
        }