public ActionResult Reject(string id) { var command = new RejectClaimRequest { ClaimRequestId = id, Reason = "Rejected by EFO claims operative." }; try { var response = _commandSender.Send(command); if (response.CommandStatus == CommandStatusEnum.Failed) { ModelState.AddModelError("ResponseError", response.Message); } return RedirectToAction("Index"); } catch (TimeoutException toe) { ModelState.AddModelError("TimeOutError", toe.Message); return RedirectToAction("Index"); } catch (Exception ex) { ModelState.AddModelError("Error", ex.Message); return RedirectToAction("Index"); } }
public void RejectClaimRequest(RejectClaimRequest command) { if (_state.CurrentClaimState == ClaimRequestStateEnum.PendingSubstantiation) { RaiseClaimRequestRejectedEvent(command.ClaimRequestId, command.Reason); } else { throw new DomainException( string.Format( "Received a command to reject this card use, but this claim request is not in a state [{0}] to process that command.", _state.CurrentClaimState)); } }