Exemple #1
0
 public async Task <ActionResult <IEnumerable <UserGetDto> > > GetUsers()
 {
     return(await _context.GetActiveUsers()
            .Include(u => u.Group)
            .Include(u => u.State)
            .Select(user => _mapper.Map <UserGetDto>(user))
            .ToListAsync());
 }
Exemple #2
0
        public User MakeSingleAdmin()
        {
            using var context = new WebApiContext(DbContextOptions);

            MakeNoAdmins();

            var users = context.GetActiveUsers().ToList();
            var admin = users[new Random().Next(users.Count)];

            admin.GroupId = context.GetAdminGroup().Id;

            context.SaveChanges();

            return(admin);
        }