示例#1
0
 public async Task <ActionResult <bool> > CheckExists(string usernameOrEmailOrPhone)
 {
     return(await _userRepository.GetAll()
            .AnyAsync(p => p.UserName == usernameOrEmailOrPhone ||
                      p.PhoneNumber == usernameOrEmailOrPhone ||
                      p.Email == usernameOrEmailOrPhone));
 }
示例#2
0
        public List <UserViewModel> GetUsers()
        {
            List <ApplicationUser> ApplicationUsers = UserRepository.GetAll().ToList();

            List <UserViewModel> ApplicationUsersView = new List <UserViewModel>();

            foreach (ApplicationUser ApplicationUser in ApplicationUsers)
            {
                UserViewModel MappedApplicationUser = new UserViewModel()
                {
                    ID             = ApplicationUser.Id,
                    UserName       = ApplicationUser.UserName,
                    Email          = ApplicationUser.Email,
                    HashedPassword = ApplicationUser.PasswordHash,
                    Active         = ApplicationUser.Active,
                };

                if (ApplicationUser.Roles.Count() > 0)
                {
                    string RoleID = ApplicationUser.Roles.First().RoleId;
                    MappedApplicationUser.RoleName = RoleRepository.GetByID(RoleID).Name;
                }

                ApplicationUsersView.Add(MappedApplicationUser);
            }
            return(ApplicationUsersView);
        }
        public IActionResult Index()
        {
            var applicationUsers = _userRepository.GetAll();
            var model            = new ApplicationUserViewModel(applicationUsers);

            return(View(model));
        }
示例#4
0
        public async Task <int> GetCurrentUserId()
        {
            var totalUsers = (await userRepository.GetAll()).Count();
            var currentId  = random.Next(1, totalUsers);

            return(currentId);
        }
示例#5
0
        // GET: /<controller>/
        public async Task <IActionResult> Index()
        {
            var applicationUsers = await _repo.GetAll();

            var model = _mapper.Map <List <ApplicationUser>, List <ApplicationUserViewModel> >(applicationUsers.ToList());

            return(View(model));
        }
 public IEnumerable<ApplicationUser> GetAdmin(string keyword, int page, int pageSize, out int totalRow)
 {
     var model = _appUserRepository.GetAll().Except(_appUserRepository.GetListUserByName("User")).Where(x => x.Id != "user12");
     if (string.IsNullOrEmpty(keyword))
     {
         totalRow = model.Count();
         return model.OrderBy(x => x.NamePCA).Skip(page * pageSize).Take(pageSize);
     }
     else
     {
         model = model.Where(x => x.FullName.ToLower().Contains(keyword.ToLower())
             || x.NamePCA.ToLower().Contains(keyword.ToLower())
             || x.Department.ToLower().Contains(keyword.ToLower()));
         totalRow = model.Count();
         return model.OrderBy(x => x.FullName).Skip(page * pageSize).Take(pageSize);
     }
 }
        public async Task <IActionResult> Index(/*DateTime? startDate = null, DateTime? endDate = null*/)
        {
            ViewData["userChart"] = GenerateUserChart();
            ViewData["gameChart"] = await GenerateGameChart();

            var usersThisMonth = userRepository.GetAll()
                                 .Where(u => u.CreationDate.Month == DateTime.Today.Month &&
                                        u.CreationDate.Year == DateTime.Today.Year)
                                 .ToList();

            var viewModel = new AdminDashboardViewModel(statisticsDataRepository.GetTodaysDataObject(),
                                                        userRepository.GetAll().Count(),
                                                        usersThisMonth.Count(u => u.DiscordUserName is null),
                                                        usersThisMonth.Count(u => u.DiscordUserName is not null));

            return(View(viewModel));
        }
        public IActionResult Secret()
        {
            var model = new SecretViewModel
            {
                Users = _userRepository.GetAll()
            };

            return(View(model));
        }
示例#9
0
        public async Task <IActionResult> Index()
        {
            var vm = new UsersIndexViewModel
            {
                Users = await userRepository.GetAll()
            };

            return(View(vm));
        }
        public async Task <IActionResult> Index()
        {
            var vm = new AdminPanelViewModel
            {
                ArticlesCount = ((IEnumerable <ArticleDTO>) await articleRepository.GetAll()).Count(),
                CategoryCount = ((IEnumerable <CategoryDTO>) await categoryRepository.GetAll()).Count(),
                userCount     = ((IEnumerable <ApplicationUserDTO>) await applicationUserRepository.GetAll()).Count(),
            };

            return(View(vm));
        }
示例#11
0
        public async Task <IActionResult> Index()
        {
            var vm = new DashboardViewModel
            {
                ArticlesCounter   = await articleRepository.GetAll(),
                CategoriesCounter = await categoryRepository.GetAll(),
                UsersCounter      = await applicationUserRepository.GetAll()
            };

            return(View(vm));
        }
示例#12
0
 public IEnumerable <AppUser> GetUsers(string filter)
 {
     if (!string.IsNullOrEmpty(filter))
     {
         return(_applicationUserRepository.GetMulti(x => x.FullName.Contains(filter)));
     }
     else
     {
         return(_applicationUserRepository.GetAll());
     }
 }
示例#13
0
        public Company GetCompanyByEmail(string companyemail)
        {
            var user = _ApplicationUserRepository.GetAll().Where(x => x.Email == companyemail).FirstOrDefault();

            if (user != null)
            {
                return(GetCompanyById(user.CompanyId));
            }

            return(null);
        }
        public async Task <List <ApplicationUserViewModel> > GetApplicationUsers()
        {
            var users = await _repository.GetAll();

            return(users.Select(user => new ApplicationUserViewModel
            {
                UserName = user.UserName,
                FirstName = user.FirstName,
                LastName = user.LastName,
                LockoutEnd = user.LockoutEnd,
                CurrentLoggedInDepartmentId = user.CurrentLoggedInDepartmentId,
                IsOranizationMaintainer = user.IsOrganizationMaintainer,
                Id = user.Id,
            }).ToList());
        }
示例#15
0
        // GET: Role
        public async Task <IActionResult> Index()
        {
            var users = await _userRepo.GetAll();

            var roles = await _roleService.GetAllRoles();

            var viewModels = users.Select(user =>
                                          new RoleViewModel
            {
                ApplicationUser   = user,
                ApplicationUserId = user.Id,
                RoleId            = _roleService.GetUserRole(user.Id).Result.Id,
                Roles             = roles,
                Disabled          = _roleService.IsUserAdministrator(user.Id).Result
            }
                                          );

            return(View(viewModels));
        }
 // GET: Projects/Create
 public ActionResult Create()
 {
     ViewBag.UsersList = new MultiSelectList(_userRepo.GetAll(), "Id", "Email");
     return(View());
 }
示例#17
0
        public string AnnualOrMonthlyReportJson(int year, int month, string taskStatusfilterKey)
        {
            Expression <Func <Demand, bool> > expression = p => p.RecordStatus == Helpdesk.Model.Enums.RecordStatus.A;

            if (year != 0 && month == 0)
            {
                expression = expression.And(p => p.CreateDate.Value.Year == year);
            }

            if (month != 0 && year != 0)
            {
                expression = p => p.CreateDate.Value.Month == month && p.CreateDate.Value.Year == year;
            }

            if (!string.IsNullOrEmpty(taskStatusfilterKey))
            {
                switch (taskStatusfilterKey)
                {
                case "dissolved":     // çözülmüş
                    expression = expression.And(p => p.IsDissolved == true);
                    break;

                case "completed":     // tamamlandı
                    expression = expression.And(p => p.IsCompleted == true);
                    break;

                case "assigned":     // atanmış
                    expression = expression.And(p => p.IsAccepted == true);
                    break;

                case "notAssigned":     // acık
                    expression = expression.And(p => p.IsAccepted != true);
                    break;

                default:
                    expression = expression.And(p => p.IsAccepted != true);
                    break;
                }
            }
            else
            {
                expression = expression.And(p => p.IsAccepted != true);
            }

            var demands = demandRepository.GetAll(expression, out int records, null);

            if (taskStatusfilterKey == "notAssigned")
            {
                var emergencys = orderOfUrgencyService.GetAll();
                var joinedData = emergencys.GroupJoin(inner: demands,
                                                      outerKeySelector: urgency => urgency.Id,
                                                      innerKeySelector: d => d.OrderOfUrgencyId,
                                                      resultSelector: (urgency, uList) => new
                {
                    Key   = urgency.Id,
                    Name  = urgency.Title,
                    Count = uList.Count()
                });
                return(JsonConvert.SerializeObject(joinedData));
            }
            else
            {
                var agents     = applicationUserRepository.GetAll(/*a => a.RecordStatus == Helpdesk.Model.Enums.RecordStatus.A*/);
                var joinedData = agents.GroupJoin(inner: demands,
                                                  outerKeySelector: agent => agent.AccountId,
                                                  innerKeySelector: d => d.ApplicationUserAccountId,
                                                  resultSelector: (agent, dList) => new
                {
                    Key   = agent.Id,
                    Name  = agent.FirstName + " " + agent.LastName,
                    Count = dList.Count()
                });

                return(JsonConvert.SerializeObject(joinedData));
            }
        }
示例#18
0
        public IActionResult Privacy()
        {
            var users = _userRepo.GetAll();

            return(View(users));
        }
示例#19
0
 public async Task <List <ApplicationUserDTO> > GetAll()
 {
     return((await _repository.GetAll()).Select(u => _mapper.Map <ApplicationUserDTO>(u)).ToList());
 }
示例#20
0
 public List <ApplicationUser> listUserID()
 {
     return(_userRepository.GetAll().ToList());
 }
示例#21
0
 public IQueryable <ApplicationUser> GetUsers()
 {
     return(_userRepository.GetAll());
 }
示例#22
0
 public async Task <IEnumerable <ApplicationUser> > GetAllUsers()
 {
     return(await _userRepo.GetAll());
 }
示例#23
0
 public IEnumerable <ApplicationUser> GetAll()
 {
     return(applicationUserRepository.GetAll());
 }
示例#24
0
        public void PostCategory_Repository_GetAll()
        {
            var list = objRepository.GetAll().ToList();

            Assert.AreEqual(1, list.Count);
        }
示例#25
0
 public IEnumerable <ApplicationUser> GetAllUsers()
 {
     return(_userAppRepository.GetAll().OrderByDescending(x => x.CreatedDate));
 }
示例#26
0
 public ApplicationUser GetUserByName(string userName)
 {
     return(_applicationUserRepository.GetAll().Where(x => x.UserName == userName).FirstOrDefault());
 }