コード例 #1
0
        public List <ActionItemViewModel> Build(Issue issue)
        {
            var orderedActions =
                issue.IssueActions.OrderBy(x => x.LogicalOrder)
                .SelectToList(x => new { ViewModelBuilder = _actionsModelFactory.GetActionsByName <IActionsViewModelFactoryItem>(x.ActionItem.ViewName), IssueAction = x });

            return(orderedActions.SelectToList(x => BuildActionItemViewModel(x.ViewModelBuilder, x.IssueAction, issue)));
        }
コード例 #2
0
        public ActionResult GetMPLink(ContactYourMPModel model)
        {
            var action = _actionsModelFactory.GetActionsByName <IActionsViewModelFactoryItemWithInputModel>(ActionViewName.ContactYourMP);

            if (string.IsNullOrEmpty(model.Postcode))
            {
                ModelState.Clear();
                model.ErrorMessage = "Please enter a valid postcode.";
                return(PartialView("~/Views/Issues/Actions/_ContactYourMP.cshtml", model));
            }
            var result = (ContactYourMPResultModel)action.BuildViewModel(model.Postcode);

            if (string.IsNullOrEmpty(result.RedirectLink))
            {
                model.Postcode     = "";
                model.ErrorMessage = "Please enter a valid postcode.";
                ModelState.Clear();
                return(PartialView("~/Views/Issues/Actions/_ContactYourMP.cshtml", model));
            }

            return(JavaScript("window.location = '" + result.RedirectLink + "'"));
        }