public ActionResult Index() { var model = new CategoryAdminPage(); model.ListCategoryType = EnumsExtensions.ListCategoryType(); var rootPath = Server.MapPath("~/"); var ndir = Server.MapPath("~/Views/Category/"); if (Directory.Exists(ndir)) { var files = Directory.GetFiles(ndir, "*.cshtml"); model.ListCategoryViewName = files.Select(i => i.Replace(rootPath, "~/").Replace("\\", "/")).ToList(); } else { model.ListCategoryViewName = new List <string>(); } var pdir = Server.MapPath("~/Views/CategoryProduct/"); if (Directory.Exists(pdir)) { var pfiles = Directory.GetFiles(pdir, "*.cshtml"); model.ListCategoryProductViewName = pfiles.Select(i => i.Replace(rootPath, "~/").Replace("\\", "/")).ToList(); } else { model.ListCategoryProductViewName = new List <string>(); } return(View(model)); }
public async Task <List <AccountFlagType> > GetNotSetListAsync(Guid accountId, CancellationToken ct) { var allFlags = EnumsExtensions.GetValues <AccountFlagType>(); var setFlags = await _storage.AccountFlags .AsNoTracking() .Where(x => x.AccountId == accountId) .Select(x => x.Type) .ToListAsync(ct); return(allFlags .Except(setFlags) .ToList()); }
public override async Task <IEnumerable <Claim> > GetUserClaimsAsync(AuthSignInModel model) { AppRole userRole = _context.AppUsers.Include(u => u.Role) .Where(x => x.Email == model.Email) .FirstOrDefault()?.Role; if (userRole == null || !userRole.IsActive) { return(new List <Claim>()); } List <AppFeature> features = _context.AppRoleFeatures .Include(f => f.AppFeature) .Where(f => f.AppRoleId == userRole.Id) .Select(f => f.AppFeature) .ToList(); if (features.Select(f => f.Name).Contains(EnumsExtensions.GetDescription(AppFeatures.FullAccess))) { features = _context.AppFeatures.ToList(); } return(_policyService.TransformFeaturesToClaims(features)); }