public void CreateTask(LandingCreateTaskModel model)
{
var creatorId = this.userRepository.GetByName(User.Identity.Name).Id;
var task = new HumanTask
{
Created = DateTime.Now,
CreatorId = creatorId,
Description = "",
Name = model.Name,
Priority = model.Priority,
ProjectId = model.ProjectId,
AssigneeId = model.AssigneeId,
Finished = model.FinishDate,
Assigned = model.AssigneeId != null ? DateTime.Now : (DateTime?)null
};
this.taskProcessor.CreateTask(task);
var taskHistory = new HumanTaskHistory
{
NewDescription = task.Description,
ChangeDateTime = DateTime.Now,
NewAssigneeId = task.AssigneeId,
NewName = task.Name,
Task = task,
NewPriority = task.Priority,
Action = ChangeHistoryTypes.Create,
UserId = this.userRepository.GetByName(User.Identity.Name).Id
};
this.taskProcessor.AddHistory(taskHistory);
this.notifier.CreateTask(task.Id);
this.newsProcessor.CreateNewsForUsersInProject(taskHistory, task.ProjectId);
}
}