public IList <Package> GetAll() { using (var context = new LandingAgencyModel()) { return(context.Package.ToList());; } }
public IList <Product> GetProducts(int packageId) { using (var context = new LandingAgencyModel()) { return(context.PackageProduct.Where(p => p.PackageId == packageId).Select(p => p.Product).ToList()); } }
public Reservation GetReservationById(int id) { using (var context = new LandingAgencyModel()) { return(context.Reservation.First(c => c.ReservationId == 1)); } }
public IList <Reservation> GetAll() { using (var context = new LandingAgencyModel()) { return(context.Reservation.ToList()); } }
public Package GetPackageById(int id) { using (var context = new LandingAgencyModel()) { var package = context.Package.First(c => c.PackageId == id); package.Products = GetProducts(package.PackageId); return(package); } }
public void Post([FromBody] Reservation res) { LandingAgencyModel LAM = new LandingAgencyModel(); Reservation reservation = new Reservation(); reservation.DurationStay = res.DurationStay; reservation.AmountTravelers = res.AmountTravelers; reservation.Package = res.Package; reservation.Client = res.Client; LAM.Reservation.Add(reservation); LAM.SaveChanges(); }
public IList <Package> GetPackageByDescription(string description) { using (var context = new LandingAgencyModel()) { var packages = context.Package.ToList(); if (description != null) { packages.RemoveAll(item => !item.PackageName.Contains(description)); } return(packages); } }
public IList <ClientType> GetAll() { using (var context = new LandingAgencyModel()) { return(context.ClientType.ToList()); } }