public IActionResult EmergencyData(ServiceHistoryModel commited) { var result = _emergencyRest.Find(new EmergencyFilter { Id = commited.EmergencyId }); if (!result.Success) { LoadBag(); ViewBag.Error = new List <string> { result?.Messages?.FirstOrDefault() ?? "Ocorreu um erro, favor tente novamente." }; return(View("Index", new EmergencyModel())); } ViewBag.CurrentServiceHistory = commited; LoadBag(); return(View("Index", result.Model)); }
public IActionResult CancelService(ServiceHistoryModel currentServiceHistory) { currentServiceHistory.ServiceHistoryStatus = ServiceHistoryStatus.Canceled; var user = _userService.GetCurrentUser(); EmergencyHistoryModel emergencyHistoryModel = new EmergencyHistoryModel() { Date = DateTime.Now, EmergencyId = currentServiceHistory.EmergencyId, EmployeeGuid = user.EmployeeGuid, }; MedicalDecisionHistoryModel medicalDecision = new MedicalDecisionHistoryModel() { Date = DateTime.Now, EmployeeGuid = user.EmployeeGuid, EmployeeName = user.EmployeeName, EmergencyId = currentServiceHistory.EmergencyId, }; ServiceCancellationHistoryModel serviceCancellationHistory = new ServiceCancellationHistoryModel { EmergencyHistoryModel = emergencyHistoryModel, MedicalDecisionHistoryModel = medicalDecision, ServiceHistoryModel = currentServiceHistory }; var result = _serviceHistoryRest.CancelServiceHistory(serviceCancellationHistory); if (!result.Success) { ViewBag.Error = result.Messages; LoadBag(); return(View("Index", new EmergencyModel())); } LoadBag(); return(View("Index", new EmergencyModel())); }