public async Task <ActionResult> UpdateByDeveloperTask(DeveloperCalendarUpdateViewModel viewModel) { string currentUserId = User.Identity.GetUserId(); ApplicationUser currentUser = await db.GetCurrentUserWithTasks(currentUserId); var updatedAssigment = await db.UpdateMapByDeveloperTask(currentUser, viewModel); db.UpdateAssignment(updatedAssigment); await db.SaveChangesAsync(); return(new JsonResult { Data = new { status = "save" } }); }
public async Task <Assignment> UpdateMapByDeveloperTask(ApplicationUser developer, DeveloperCalendarUpdateViewModel viewModel) { var assignment = developer.Assignments.SingleOrDefault(x => x.Id == viewModel.AssigmentId); var status = await db.Statuses.SingleOrDefaultAsync(x => x.Id == viewModel.StatusId); assignment.Progress = viewModel.Progress; assignment.Progress = viewModel.StatusId; assignment.Status = status; assignment.StatusId = viewModel.StatusId; return(assignment); }