예제 #1
0
        public async Task <ActionResult> Update(OperationRouteValue routeValue)
        {
            var model = await GetViewModel(routeValue);

            var helper = new OperationsHelper(routeValue, TempData, Url);

            helper.Update(model);

            if (!helper.IsValid())
            {
                ModelState.AddModelError("Operation", $"Select yes if you give {model.ProviderName} permission to {model.Operation.GetDescription().ToLower()}");
                return(View("Set", model));
            }

            var next = helper.Next();

            if (next == Operation.NotSet)
            {
                return(RedirectToAction("Confirm", new OperationRouteValue {
                    AccountProviderId = routeValue.AccountProviderId.Value,
                    AccountLegalEntityId = routeValue.AccountLegalEntityId.Value
                }));
            }

            return(RedirectToAction("Set", "Operations", new OperationRouteValue {
                OperationId = (short)next,
                AccountProviderId = routeValue.AccountProviderId.Value,
                AccountLegalEntityId = routeValue.AccountLegalEntityId.Value
            }));
        }
예제 #2
0
        public async Task <ActionResult> Set(OperationRouteValue routeValue)
        {
            var model = await GetViewModel(routeValue);

            var helper = new OperationsHelper(routeValue, TempData, Url);

            helper.Set(model);
            return(View(model));
        }
예제 #3
0
        public async Task <ActionResult> Confirm(OperationRouteValue routeValue)
        {
            var helper = new OperationsHelper(routeValue, TempData, Url);

            if (helper.Changes == null)
            {
                return(RedirectToAction("Get", new GetAccountProviderLegalEntityRouteValues {
                    AccountProviderId = routeValue.AccountProviderId.Value, AccountLegalEntityId = routeValue.AccountLegalEntityId.Value
                }));
            }

            var model = await GetConfirmViewModel(routeValue);

            helper.Confirm(model);
            ;
            return(View(model));
        }