public override TransportCompany FindByName(string name) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { bool exist = ((TBContext)context).TransportCompany.Any(u => u.CompanyName == name); if (exist) { TransportCompany query = ((TBContext)context).TransportCompany.First(u => u.CompanyName == name); return(query); } else { return(null); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override Transport FindByName(string name) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { bool exist = ((TBContext)context).Transport.Any(u => u.Description == name); if (exist) { Transport query = ((TBContext)context).Transport.Include(x => x.DestinationCity).Include(x => x.OriginCity).First(u => u.Description == name); return(query); } else { return(null); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public Product FindByCode(string code) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { bool exist = ((TBContext)context).Product.Any(u => u.ProductCode == code); if (exist) { Product query = ((TBContext)context).Product.Include(x => x.Hotel).Include(x => x.Transport).Include(x => x.SportEvent).First(u => u.ProductCode == code); return(query); } else { return(null); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override AppUser FindByName(string name) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { bool exist = ((TBContext)context).AppUser.Any(u => u.Name == name); if (exist) { AppUser query = ((TBContext)context).AppUser.Include(x => x.City).First(u => u.Name == name); return(query); } else { return(null); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override RoomBooking FindByName(string name) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { bool exist = ((TBContext)context).RoomBooking.Any(u => u.Room.Name == name); if (exist) { RoomBooking query = ((TBContext)context).RoomBooking.Include(x => x.Room).Include(x => x.Hotel).First(u => u.Room.Name == name); return(query); } else { return(null); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override TransportCompany FindById(int id) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { TransportCompany query = ((TBContext)context).TransportCompany.First(u => u.Id == id); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override List <TransportCompany> GetAll(Expression <Func <TransportCompany, bool> > Predicate) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { var query = context.Set <TransportCompany>().Where(Predicate).ToList(); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override PurchaseOrderDetail FindByName(string name) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { PurchaseOrderDetail query = ((TBContext)context).PurchaseOrderDetail.Include(x => x.Product).First(u => u.Description == name); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override void Update(PurchaseOrderDetail entity) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { context.Entry(entity).State = EntityState.Modified; context.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override PurchaseOrder FindById(int id) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { PurchaseOrder query = ((TBContext)context).PurchaseOrder.Include(x => x.PurchaseOrderDetails).First(u => u.Id == id); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <PurchaseOrder> GetPurchaseOrderbyProductId(int id, DateTime starDate, DateTime endDate) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { var list = context.Set <PurchaseOrder>().Where(x => x.CreationDate >= starDate && x.CreationDate <= endDate).Include(x => x.PurchaseOrderDetails.Select(y => y.ProductId == id)).ToList(); return(list); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override List <RoomBooking> GetAll(Expression <Func <RoomBooking, bool> > Predicate) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { var query = context.Set <RoomBooking>().Include(x => x.Room).Include(x => x.Hotel).Where(Predicate).ToList(); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override List <AppUser> GetAll() { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { var query = context.Set <AppUser>().Include(x => x.City).ToList(); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override List <RoomBooking> GetAll() { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { var query = context.Set <RoomBooking>().ToList(); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <PurchaseOrder> FindByCustomerId(int id) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { List <PurchaseOrder> query = ((TBContext)context).PurchaseOrder.Include(x => x.PurchaseOrderDetails.Select(z => z.Product)).Where(u => u.CustomerId == id).ToList(); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override Transport FindById(int id) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { Transport query = ((TBContext)context).Transport.Include(x => x.DestinationCity).Include(x => x.OriginCity).First(u => u.Id == id); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override List <PurchaseOrder> GetAll(Expression <Func <PurchaseOrder, bool> > Predicate) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { var query = context.Set <PurchaseOrder>().Where(Predicate).Include(x => x.PurchaseOrderDetails.Select(y => y.Product)).ToList(); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override RoomBooking FindById(int id) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { RoomBooking query = ((TBContext)context).RoomBooking.Include(x => x.Room).Include(x => x.Hotel).First(u => u.Id == id); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override AppUser FindById(int id) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { AppUser query = ((TBContext)context).AppUser.First(u => u.Id == id); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override List <Transport> GetAll(Expression <Func <Transport, bool> > Predicate) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { var query = context.Set <Transport>().Include(x => x.DestinationCity).Include(x => x.OriginCity).Where(Predicate).ToList(); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override SportEvent FindById(int id) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { SportEvent query = ((TBContext)context).SportEvent.Include(x => x.City).First(u => u.Id == id); return(query); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override int Add(PurchaseOrderDetail entity) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { ((TBContext)context).PurchaseOrderDetail.Add(entity); return(entity.Id); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override int Add(AppUser entity) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { context.Set <AppUser>().Add(entity); context.SaveChanges(); int id = entity.Id; return(id); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public override void Update(AppUser entity) { try { if (context == null || IsDisposed()) { context = new TBContext(); } using (context) { var itemEntity = ((TBContext)context).AppUser.First(x => x.Id == entity.Id); var item = context.Entry <AppUser>(itemEntity); item.State = EntityState.Modified; itemEntity.Names = entity.Names; itemEntity.Surname = entity.Surname; itemEntity.MobileNumber = entity.MobileNumber; itemEntity.Phone = entity.Phone; itemEntity.Address1 = entity.Address1; itemEntity.Address2 = entity.Address2; itemEntity.Genre = entity.Genre; itemEntity.Category = entity.Category; itemEntity.Email = entity.Email; itemEntity.City = entity.City; context.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public RoomBookingRepository(TBContext context) : base(context) { }
public AppUserRepository(TBContext context) : base(context) { }
public CityRepository(TBContext context) : base(context) { }
public ProductRepository(TBContext context) : base(context) { }
public TransportRepository(TBContext context) : base(context) { }
public SportEventRepository(TBContext context) : base(context) { }