public IActionResult UpdateMultiPhase(ModifiedPhase modifiedPhase) { var currentUser = userService.GetCurrentUser(User.Identity.Name); foreach (var i in modifiedPhase.ListPhaseDelete) // Xóa những phase có trong danh sách id xóa { var isPhaseExist = phaseService.CheckExist(x => x.PhaseId == i); if (isPhaseExist == true) { phaseService.Delete(i); } } foreach (var i in modifiedPhase.ListFieldDelete) // Xóa những field có trong danh sách id xóa { var isFieldExist = fieldService.CheckExist(x => x.FieldId == i); if (isFieldExist == true) { fieldService.Delete(i); } } foreach (var i in modifiedPhase.ListEmployeeDelete) // Xóa những employee có trong danh sách id xóa { var isFieldExist = phaseEmployeeService.CheckExist(x => x.PhaseEmployeeId == i); if (isFieldExist == true) { phaseEmployeeService.Delete(i); } } foreach (var phase in modifiedPhase.Phase) { if (phase.PhaseId == null || phase.PhaseId.Equals("")) { phase.PhaseId = Guid.NewGuid(); } phaseService.AddOrUpdate(phase, currentUser); } var processUpdated = processService.GetById(modifiedPhase.ProcessId); processUpdated.UpdatedAt = DateTime.Now; processUpdated.UpdatedBy = currentUser.Employee.First().FullName + " - " + currentUser.Employee.First().EmployeeCode; phaseService.Save(); return(Ok()); }
public BaseResponse <bool> Delete(Guid id) { return(_phaseService.Delete(id)); }