public async Task <ExcecutorDTO> AddExcecutor(ExcecutorDTO user) { var task = await taskRepo.FindByIdAsync(user.TaskId); TaskHistory history = new TaskHistory(); history.DateUpdated = DateTime.Now; history.UpdatedByUser = task.Customer; history.StartTaskStatus = await statusRepo.FindByIdAsync((int)task.TaskStatusId); task.ExecutorId = user.ExcecutorId; task.UpdatedById = task.CustomerId; task.DateUpdated = DateTime.Now; var status = (await statusRepo.GetWithIncludeAsync(s => s.Type == "In progress")).FirstOrDefault(); task.TaskStatusId = status.Id; history.FinalTaskStatus = await statusRepo.FindByIdAsync(status.Id); await taskRepo.UpdateAsync(task); await historyRepo.CreateAsync(history); return(user); }
public async Task <ActionResult <ExcecutorDTO> > AddExcecutor([FromBody] ExcecutorDTO user) { var task = await tasksInfoService.GetTaskDescription(user.TaskId); string msg = $"Now you can start execute task {task.Title}"; await notificationService.AddNotification(msg, user.ExcecutorId); await _hubContext.Clients.All.SendAsync("sendMessage", user.ExcecutorId, msg); var dtos = await tasksInfoService.AddExcecutor(user); return(Ok(dtos)); }