Exemplo n.º 1
0
        public ActionResult SupervisorAdmin()
        {
            Users user   = CMSService.GetUserByUserName(username);
            int   userId = 0;

            if (user != null)
            {
                userId = user.UserId;
            }
            List <int> ContractIds = new List <int>();

            ContractIds = CMSService.GetContractsByUserId(userId);

            UserAdministration ua = new UserAdministration();



            List <viewUser> UserList = CMSService.GetSupervisorAdmin(ContractIds);

            ua.UsersToReview    = UserList.Where(x => x.IsActive == false && x.IsApproved == false).ToList();
            ua.Users            = UserList.Where(x => x.IsActive == true && ContractIds.Any(c => x.UserContracts.Any(uc => uc.ContractId == c && uc.IsActive == true))).ToList();
            ua.UsersDisApproved = UserList.Where(x => x.IsDisApproved == true && x.IsActive == false).ToList();
            ua.UsersInactive    = UserList.Where(x => x.IsActive == false && x.IsApproved == true).ToList();
            List <int> SupervisorContractIds = CMSService.GetContractsByUserId(user.UserId);

            ua.Contracts = CMSService.GetContracts().Where(c => SupervisorContractIds.Contains(c.Id)).ToList();

            return(View(ua));
        }