/// <summary> /// The create single task view model by id. /// </summary> /// <param name="taskId"> /// The task id. /// </param> /// <param name="viewStyle"> /// The view Style. /// </param> /// <returns> /// The BinaryStudio.TaskManager.Web.Models.SingleTaskViewModel. /// </returns> private SingleTaskViewModel CreateSingleTaskViewModelById(int taskId, bool? viewStyle) { var task = this.taskProcessor.GetTaskById(taskId); var creatorName = task.CreatorId.HasValue ? this.userProcessor.GetUser((int)task.CreatorId).UserName : "******"; var assigneeName = task.AssigneeId.HasValue ? this.userProcessor.GetUser((int)task.AssigneeId).UserName : "******"; var blockedTaskName = "none"; if (task.BlockingTaskId != 0) { blockedTaskName = this.taskProcessor.GetTaskById(task.BlockingTaskId).Name; } var model = new SingleTaskViewModel { HumanTask = task, CreatorName = creatorName, AssigneeName = assigneeName, TaskHistories = this.taskProcessor.GetAllHistoryForTask(taskId).OrderByDescending( x => x.ChangeDateTime) .ToList(), Priorities = this.taskProcessor.GetPrioritiesList(), BlockedTaskName = blockedTaskName, ViewStyle = viewStyle }; return model; }
public ActionResult Edit(SingleTaskViewModel model) { if (this.ModelState.IsValid) { this.taskProcessor.UpdateTask(model.HumanTask); this.taskProcessor.AddHistory(new HumanTaskHistory { NewDescription = model.HumanTask.Description, ChangeDateTime = DateTime.Now, NewAssigneeId = model.HumanTask.AssigneeId, NewName = model.HumanTask.Name, Task = model.HumanTask, NewPriority = model.HumanTask.Priority, }); return this.RedirectToAction("AllManagersWithTasks"); } this.ViewBag.PossibleCreators = new List<User>(); this.ViewBag.PossibleAssignees = new List<User>(); return this.View(model); }
/// <summary> /// The create single task view createModel by id. /// </summary> /// <param name="id"> /// The id. /// </param> /// <returns> /// The BinaryStudio.TaskManager.Web.Models.SingleTaskViewModel. /// </returns> private SingleTaskViewModel CreateSingleTaskViewModelById(int id) { var model = new SingleTaskViewModel(); var task = this.taskProcessor.GetTaskById(id); var creatorName = task.CreatorId.HasValue ? this.userRepository.GetById((int)task.CreatorId).UserName : "******"; var assigneeName = task.AssigneeId.HasValue ? this.userRepository.GetById((int)task.AssigneeId).UserName : "******"; model.HumanTask = task; model.CreatorName = creatorName; model.AssigneeName = assigneeName; model.TaskHistories = this.taskProcessor.GetAllHistoryForTask(id).OrderByDescending(x => x.ChangeDateTime).ToList(); return model; }
public ActionResult Edit(int id) { var humantask = this.taskProcessor.GetTaskById(id); var model = new SingleTaskViewModel { HumanTask = humantask, Priorities = this.taskProcessor.GetPrioritiesList().OrderBy(x => x.Value) }; this.ViewBag.PossibleCreators = new List<User>(); this.ViewBag.PossibleAssignees = new List<User>(); return this.View(model); }