private static void EnsureSupportRoleIsSupported(ConnectionStringSettings connectionString, ICommandBus commandBus) { var accounts = new AccountDao(() => new BookingDbContext(connectionString.ConnectionString)); var allAdmins = accounts.GetAll(); var admins = allAdmins.Where(a => a.Roles == (int)OldRoles.Admin); foreach (var admin in admins) { commandBus.Send(new UpdateRoleToUserAccount { AccountId = admin.Id, RoleName = RoleName.Admin, }); } var superAdmins = allAdmins.Where(a => a.Roles == (int)OldRoles.SuperAdmin); foreach (var admin in superAdmins) { commandBus.Send(new UpdateRoleToUserAccount { AccountId = admin.Id, RoleName = RoleName.SuperAdmin, }); } }
public Result <string, ICollection <Account> > GetAll() { try { _logger.LogInformation("Getting accounts"); var accounts = _accountDao.GetAll(); return(Result <string, ICollection <Account> > .ForSuccess(accounts)); } catch (Exception ex) { _logger.LogError("Can't get accounts", ex); return(Result <string, ICollection <Account> > .ForFailure("Can't get accounts")); } }
public AccountListViewModel GetAccounts(IDataProtector protector, List <FilterValue> filterValues, int pageSize, int pageIndex) { Mapper.Initialize(cfg => cfg.CreateMap <Account, AccountRegisterViewModel>() .ForMember(dest => dest.Id, opt => opt.MapFrom(src => protector.Protect(src.Id.ToString()))) ); var resultList = Mapper.Map <List <Account>, List <AccountRegisterViewModel> >(_accountDao.GetAll(filterValues, pageSize, pageIndex)); var itemResult = new AccountListViewModel() { Accounts = resultList }; var count = _accountDao.GetCount(filterValues); return(ConfigurePagination(itemResult, pageIndex, pageSize, filterValues, count)); }
public List <AccountObject> GetAll() { return(ModelAccont.GetAll()); }
public IEnumerable <Account> GetAll() { return(accountDao.GetAll()); }