public virtual IEnumerable <TEntity> Get(Expression <Func <TEntity, bool> > filter = null) { IQueryable <TEntity> query = context.Set <TEntity>(); if (filter != null) { query = query.Where(filter); } return(query.ToList()); }
public virtual IQueryable <TEntity> GetAll() { try { return(AirportContext.Set <TEntity>()); } catch (Exception ex) { throw new Exception($"Couldn't retrieve entities: {ex.Message}"); } }
public virtual Task <List <Aircraft> > GetAsync(int?filter = null) { IQueryable <Aircraft> query = Context.Set <Aircraft>().Include(c => c.AircraftType); if (filter != null) { query = query.Where(e => e.Id == filter); } return(query.ToListAsync()); }
public virtual async Task <List <Flight> > GetAsync(int?filter = null) { IQueryable <Flight> query = Context.Set <Flight>().Include(c => c.Tickets); if (filter != null) { query = query.Where(e => e.Id == filter); } return(await query.ToListAsync()); }
public virtual async Task <List <Crew> > GetAsync(int?filter = null) { IQueryable <Crew> query = Context.Set <Crew>().Include(c => c.Stewardesses).Include(c => c.Pilot); if (filter != null) { query = query.Where(e => e.Id == filter); } return(await query.ToListAsync()); }
public virtual async Task <List <TEntity> > GetAsync(int?filter = null) { IQueryable <TEntity> query = Context.Set <TEntity>(); if (filter != null) { query = query.Where(e => e.Id == filter); } return(await query.ToListAsync()); }
public virtual async Task <List <Departure> > GetAsync(int?filter = null) { IQueryable <Departure> query = Context.Set <Departure>().Include(c => c.Crew).Include(a => a.Aircraft).Include(f => f.Flight); if (filter != null) { query = query.Where(e => e.Id == filter); } return(await query.ToListAsync()); }
public virtual List <TEntity> Get(int?filter = null) { IQueryable <TEntity> query = Context.Set <TEntity>(); if (filter != null) { query = query.Where(e => e.Id == filter); } return(query.ToList()); }
public virtual List <Flight> Get(int?filter = null) { IQueryable <Flight> query = Context.Set <Flight>().Include(c => c.Tickets); if (filter != null) { query = query.Where(e => e.Id == filter); } return(query.ToList()); }
public async Task <UserDTO> Authentificate(string nickname, string password) { if (string.IsNullOrEmpty(nickname) || string.IsNullOrEmpty(password)) { throw new ArgumentNullException("Username or password can not be empty"); } var user = (await context.Set <User>().SingleOrDefaultAsync(u => u.Login == nickname)); if (user == null || !VerifyPasswordHash(password, user.PasswordHash, user.PasswordSalt)) { throw new ArgumentException("Wrong email or password"); } await context.SaveChangesAsync(); return(mapper.Map <User, UserDTO>(user)); }
public virtual async Task <List <TEntity> > GetAll() { return(await context.Set <TEntity>().ToListAsync()); }
public virtual T GetById(int id) { return(context.Set <T>().Find(id)); }
public virtual IEnumerable <TEntity> Get() { return(_ctx.Set <TEntity>()); }
public Repository(AirportContext dataContext) { DataContext = dataContext; DataSet = dataContext.Set <T>(); }
public virtual async Task <List <TEntity> > GetAsync() { return(await _ctx.Set <TEntity>().ToListAsync()); }
public Repository(AirportContext ctx) { _ctx = ctx; _dbSet = _ctx.Set <T>(); }
public GenericRepository(AirportContext context) { this.dbSet = context.Set <TEntity>(); }
public void Create(Crew model) { airport.Set <Crew>().Add(model); }