public Accomodation GetAccomodationId(int Id) { using (var context = new HMSContext()) { return context.Accomodations.Find(Id); } }
public bool SaveAccomodationType(AccomodationType accomodationType) { var context = new HMSContext(); context.AccomodationTypes.Add(accomodationType); return(context.SaveChanges() > 0); }
public BookingsController(HMSContext context, AccomodationPackagesService accomodationPackagesService , BookingService bookingService) { _context = context; _accomodationPackagesService = accomodationPackagesService; _bookingService = bookingService; }
public void UpdateState(List <int> ids, bool status) { HMSContext context = new HMSContext(); if (status == true) { foreach (var t in ids) { var obj = context.Accomodations.Find(t); obj.IsHold = true; context.Entry(obj).State = EntityState.Modified; context.SaveChanges(); } } else { foreach (var t in ids) { var obj = context.Accomodations.Find(t); obj.IsHold = false; context.Entry(obj).State = EntityState.Modified; context.SaveChanges(); } } }
public EmployeeController() { _context = new HMSContext(); _employeeReposiory = new EFRepository <Employee>(_context); _roleReposiory = new EFRepository <Role>(_context); ViewBag.RoleList = _roleReposiory.Get().ToList(); }
//Function edit public bool UpdateAccomodationPackage(AccomodationPackage accomodationPackage) { var context = new HMSContext(); context.Entry(accomodationPackage).State = System.Data.Entity.EntityState.Modified; return(context.SaveChanges() > 0); }
public Accomodation GetAccomodationByID(int ID) { using (var context = new HMSContext()) { return(context.Accomodations.Find(ID)); } }
public int TotalAccomodationsReserved() { HMSContext db = new HMSContext(); return(db.Bookings.Count(a => a.Status == "Reserved")); }
public int TotalAccomodationsCheckedIn() { HMSContext db = new HMSContext(); return(db.Bookings.Count(a => a.Status == "CheckedIn")); }
public bool UpdateAccomodation(Accomodation accomodation) { var _context = new HMSContext(); _context.Entry(accomodation).State = System.Data.Entity.EntityState.Modified; return(_context.SaveChanges() > 0); }
public int AccomodationsCount() { HMSContext db = new HMSContext(); return(db.Accomodations.Count()); }
public IEnumerable <Picture> getPicturesByIds(List <int> picIds) { var context = new HMSContext(); // find each picIds inside the Picture database return(picIds.Select(x => context.Picture.Find(x))); }
public IEnumerable <Pictures> GetPictureByIDs(List <int> pictureIDs) { using (var context = new HMSContext()) { return(pictureIDs.Select(x => context.Picture.Find(x)).ToList()); } }
public bool UpdateAccomodationType(AccomodationType accomodationType) { var context = new HMSContext(); context.Entry(accomodationType).State = EntityState.Modified; return(context.SaveChanges() > 0); }
public bool SavePicture(Picture picture) { var context = new HMSContext(); context.Pictures.Add(picture); return(context.SaveChanges() > 0); }
public IEnumerable <Booking> ComepleteBookingDetail() { HMSContext db = new HMSContext(); return(db.Bookings.ToList()); }
public AccomodationsController(HMSContext context, AccomodationPackagesService accomodationPackagesService, AccomodationService accomodationService) { _context = context; this.accomodationPackagesService = accomodationPackagesService; this.accomodationService = accomodationService; }
public List <Message> GetMessages() { HMSContext db = new HMSContext(); return(db.Messages.ToList()); }
//Function create public bool SaveAccomodation(Accomodation accomodation) { var context = new HMSContext(); context.Accomodations.Add(accomodation); return(context.SaveChanges() > 0); }
public IEnumerable <Accomodation> SearchAccomodations(string searchTerm, int?accomodationPackageID, int page, int recordSize) { var context = new HMSContext(); var accomodations = context.Accomodations.AsQueryable(); if (!string.IsNullOrEmpty(searchTerm)) { accomodations = accomodations.Where(a => a.Name.ToLower().Contains(searchTerm.ToLower())); } if (accomodationPackageID.HasValue && accomodationPackageID.Value > 0) { accomodations = accomodations.Where(a => a.AccomodationPackageID == accomodationPackageID.Value); } var skip = (page - 1) * recordSize; return(accomodations.OrderBy(x => x.AccomodationPackageID).Skip(skip).Take(recordSize).ToList()); }
public bool UpdateAccommodationType(AccommodationType model) { var context = new HMSContext(); context.Entry(model).State = System.Data.Entity.EntityState.Modified; return(context.SaveChanges() > 0); }
public int SearchAccomodationsCount(string searchTerm, int?accomodationPackageID) { var context = new HMSContext(); var accomodations = context.Accomodations.AsQueryable(); if (!string.IsNullOrEmpty(searchTerm)) { accomodations = accomodations.Where(a => a.Name.ToLower().Contains(searchTerm.ToLower())); } if (accomodationPackageID.HasValue && accomodationPackageID.Value > 0) { accomodations = accomodations.Where(a => a.AccomodationPackageID == accomodationPackageID.Value); } return(accomodations.Count()); }
/// <summary> /// Admin Actions in Booking Service /// </summary> /// <param name="ids"></param> /// <param name="status"></param> public IEnumerable <Booking> GetAllBookings() { HMSContext context = new HMSContext(); var model = context.Bookings.ToList(); return(model); }
public AccomodationPackage GetAccomodationPackageById(int id) { using (var _context = new HMSContext()) { return(_context.AccomodationPackages.Find(id)); } }
public IEnumerable <AccomadationPackage> SearchAccomadationPackages(string searchTerm, int?accomadationTypeID, int pageSize, int page) // we cants use 'using' statement with IEnumerable { var context = new HMSContext(); var accomadationPackage = context.AccomadationPackage.AsQueryable(); // 'AsQueryable' will allow us to use query on the AccomadationType such as using 'Where' on it // find based on searchTerm if (!string.IsNullOrEmpty(searchTerm)) { // check if the searchterm exist in the database column Name accomadationPackage = accomadationPackage.Where(x => x.Name != null && x.Name.ToLower().Contains(searchTerm.ToLower())); } // find based on accomadationTypeID if (accomadationTypeID.HasValue && accomadationTypeID.Value > 0) { // check if the searchterm exist in the database column Name accomadationPackage = accomadationPackage.Where(x => x.AccomadationTypeID == accomadationTypeID.Value); } // skip = (1 - 1) * 3 = 0 * 3 = 0 // skip = (2 - 1) * 3 = 1 * 3 = 3 // skip = (3 - 1) * 3 = 2 * 3 = 6 var skip = (page - 1) * pageSize; return(accomadationPackage.OrderBy(x => x.AccomadationTypeID).Skip(skip).Take(pageSize).AsEnumerable()); // we have to use the 'sortBy' if we are going to use 'Skip' }
public bool SaveAccomodationPackage(AccomodationPackage accomodationPackage) { var _context = new HMSContext(); _context.AccomodationPackages.Add(accomodationPackage); return(_context.SaveChanges() > 0); }
public bool DeleteAccomodationType(AccomodationType accomodationType) { var context = new HMSContext(); context.Entry(accomodationType).State = System.Data.Entity.EntityState.Deleted; return(context.SaveChanges() > 0); }
public bool DeleteAccomodationPackage(AccomodationPackage accomodationPackage) { var _context = new HMSContext(); _context.Entry(accomodationPackage).State = System.Data.Entity.EntityState.Deleted; return(_context.SaveChanges() > 0); }
public int CountAccomodationByPackage(int?accomodationPackageID) { var context = new HMSContext(); var packageCount = context.Accomodations.Count(a => a.AccomodationPackageId == accomodationPackageID); return(packageCount); }
public TechController() { _context = new HMSContext(); _roleRepository = new EFRepository <Role>(_context); _menuRepository = new EFRepository <Menu>(_context); _menuRoleMapRepository = new EFRepository <MenuRoleMap>(_context); }