예제 #1
0
        //
        // GET: /Claims/SubmitClaim
        public ActionResult SubmitClaim()
        {
            var viewModel = new SubmitClaimViewModel
            {
                ClaimTypes = BuildClaimTypesSelectList(_claimTypesReadModel),
            };

            return(View(viewModel));
        }
예제 #2
0
        public ActionResult SubmitClaim(SubmitClaimViewModel model)
        {
            try
            {
                var command = model.Command;
                command.ParticipantId  = MvcApplication.ParticipantId;
                command.CompanyId      = MvcApplication.CompanyId;
                command.ClaimRequestId = Guid.NewGuid().ToString();
                command.Source         = "MFO";
                CommandResponse response = _commandSender.Send(command);

                if (response.CommandStatus == CommandStatusEnum.Failed)
                {
                    //set the error message in the ViewData and return to the view
                    ModelState.AddModelError("ResponseError", response.Message);
                    var newModel = new SubmitClaimViewModel
                    {
                        Command    = command,
                        ClaimTypes = BuildClaimTypesSelectList(_claimTypesReadModel),
                    };
                    newModel.Command = command;
                    return(View(newModel));
                }

                return(RedirectToAction("Index"));
            }
            catch (TimeoutException toe)
            {
                ModelState.AddModelError("TimeOutError", toe.Message);
                return(View(new SubmitClaimViewModel
                {
                    ClaimTypes = BuildClaimTypesSelectList(_claimTypesReadModel)
                }));
            }
            catch
            {
                return(View(new SubmitClaimViewModel
                {
                    ClaimTypes = BuildClaimTypesSelectList(_claimTypesReadModel)
                }));
            }
        }