public async Task <ActionResult> Update(UpdateAccountProviderLegalEntityViewModel model) { var operations = model.Operations.Where(o => o.IsEnabled.HasValue && o.IsEnabled.Value).Select(o => o.Value).ToHashSet(); var command = new UpdatePermissionsCommand(model.AccountId.Value, model.AccountProviderId.Value, model.AccountLegalEntityId.Value, model.UserRef.Value, operations); await _mediator.Send(command); if (Session["Invitation"] as bool? == true) { var provider = await _mediator.Send(new GetAccountProviderQuery(model.AccountId.Value, model.AccountProviderId.Value)); return(Redirect($"{_employerUrls.Account()}/addedprovider/{HttpUtility.UrlEncode(provider.AccountProvider.ProviderName)}")); } return(RedirectToAction("Updated", new UpdatedAccountProviderLegalEntityRouteValues { AccountProviderId = model.AccountProviderId.Value, AccountLegalEntityId = model.AccountLegalEntityId.Value })); }
public ActionResult Added(AddedAccountProviderViewModel model) { switch (model.Choice) { case "SetPermissions": return(RedirectToAction("Get", new GetAccountProviderRouteValues { AccountProviderId = model.AccountProviderId.Value })); case "AddTrainingProvider": return(RedirectToAction("Find")); case "GoToHomepage": return(Redirect(_employerUrls.Account())); default: throw new ArgumentOutOfRangeException(nameof(model.Choice), model.Choice); } }