public ActionResult WellMed(long eventCustomerResultId, long accountId, long customerId, long eventId) { var model = new WellMedAttestationListModel(); var attestations = _wellmedAttestationService.GetbyEventCustumerResultId(eventCustomerResultId); if (attestations != null && attestations.Any()) { model.Attestations = attestations; } model.EventCustomerResultId = eventCustomerResultId; model.CustomerId = customerId; model.EventId = eventId; GetDetails(model); return(View(model)); }
public ActionResult WellMed(WellMedAttestationListModel model, bool saveAndContinue) { var attestationValidator = IoC.Resolve <WellMedAttestationViewModelValidator>(); var invalidattestationList = new List <WellMedAttestationViewModel>(); foreach (var attestation in model.Attestations) { var result = ValidateModel(attestationValidator, attestation); if (!string.IsNullOrEmpty(result)) { attestation.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(result); invalidattestationList.Add(attestation); } } if (!invalidattestationList.Any()) { _wellmedAttestationService.Delete(model.EventCustomerResultId); foreach (var attestation in model.Attestations) { try { using (var scope = new TransactionScope()) { _wellmedAttestationService.Save(attestation); scope.Complete(); } } catch (Exception ex) { attestation.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex.Message); invalidattestationList.Add(attestation); } } } else { GetDetails(model); return(View(model)); } return(!saveAndContinue?Redirect("/Medical/Results/ResultStatusList?EventId=" + model.EventId) : null); }