public async Task <ActionResult> ListaRoles() { var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(this.DbContext)); bool cuentasAuth = FaAuthorizeAttribute.IsAuthorized(this.User, nameof(CuentaController), nameof(ListaRoles), this.HttpContext); if (!cuentasAuth && FaAuthorizeAttribute.IsAuthorized(this.User, nameof(CuentaController), nameof(ListaCuentas), this.HttpContext)) { return(RedirectToAction(nameof(ListaCuentas))); } if (cuentasAuth) { return(this.View(roleManager.Roles.ToList())); } else { return(new HttpStatusCodeResult(401)); } }
public async Task <ActionResult> ListaCuentas() { if (this.DataService == null) { this.DataService = new CuentaDataService(this.GetIdentityUser(this.User.Identity.Name).Result, this.UserManager, this.RoleManager); } bool cuentasAuth = FaAuthorizeAttribute.IsAuthorized(this.User, nameof(CuentaController), nameof(ListaCuentas), this.HttpContext); if (!cuentasAuth && FaAuthorizeAttribute.IsAuthorized(this.User, nameof(CuentaController), nameof(ListaRoles), this.HttpContext)) { return(RedirectToAction(nameof(ListaRoles))); } if (cuentasAuth) { return(this.View(await this.DataService.GetCuentas())); } else { return(new HttpStatusCodeResult(401)); } }