public async Task <ActionResult> Index() { var viewModel = new UsersManagementIndexViewModel { Users = await _backOfficeUsersRepository.GetAllAsync() }; return(View(viewModel)); }
public async Task UpdateUsersAndRoles() { if ((DateTime.UtcNow - _lastCacheUpdated).TotalSeconds > 30) { _usersCache = (await _usersRepository.GetAllAsync()).ToDictionary(itm => itm.Id); _rolesCache = (await _rolesRepository.GetAllRolesAsync()).Select(BackofficeUserRole.Create).Cast <IBackofficeUserRole>().ToArray(); _lastCacheUpdated = DateTime.UtcNow; } }