Exemple #1
0
        public async override Task <ClaimsPrincipal> CreateAsync(ApplicationUser user)
        {
            var principal = await base.CreateAsync(user);

            ((ClaimsIdentity)principal.Identity).AddClaims(new[] {
                new Claim(ClaimNames.IsInternal, (user.EmployerID == GlobalCache.GetTexasTRCompanyID(_context)).ToString()),
                new Claim(ClaimNames.EmployerID, user.EmployerID.ToString()),
                new Claim(ClaimNames.IsAdmin, user.IsAdmin.ToString())
            });
            return(principal);
        }
Exemple #2
0
        public static SelectList CompanyList(InventoryContext context, Company selected = null, bool excludeInternal = true)
        {
            IEnumerable <Company> suppliers = context.Companies;

            if (excludeInternal)
            {
                int texasTRID = GlobalCache.GetTexasTRCompanyID(context);
                suppliers = suppliers.Where(s => s.ID != texasTRID);
            }

            SelectList ret = new SelectList(suppliers, nameof(Company.ID), nameof(Company.Name), selected); //Hope that this works when selected is null.

            return(ret);
        }