static List <ApptAvailability> GetApptAvailability() { using (SlotsTableEntities db = new SlotsTableEntities()) { return((from a in db.usp_GetAvailability() select new ApptAvailability { AvailabilityStartDateTime = (DateTime)a.StartDateTime, AvailabilityEndDateTime = (DateTime)a.EndDateTime, AvailabilityId = a.AvailabilityId, DayOfWeek = (int)a.DayOfWeek }).ToList()); } }
static List <ApptException> GetApptExceptions() { using (SlotsTableEntities db = new SlotsTableEntities()) { return((from a in db.usp_GetExceptionTimes() select new ApptException { ExceptionEndDateTime = (DateTime)a.ExceptionEndDate, ExceptionStartDateTime = (DateTime)a.ExceptionStartDate, ExceptionId = a.ExceptionId, IsRecurring = (bool)a.IsRecurring }).ToList()); } }
static List <AppointmentType> GetApptTypes() { using (SlotsTableEntities db = new SlotsTableEntities()) { return((from a in db.usp_GetApptTypes() select new AppointmentType { ApptDesc = a.ApptDescription, ApptLength = (int)a.ApptLength, ApptType = a.ApptType, ApptTypeId = a.ApptTypeId }).ToList()); } }
static List <ApptModel> GetAppointments(DateTime apptDate) { using (SlotsTableEntities db = new SlotsTableEntities()) { List <ApptModel> appts = new List <ApptModel>(); appts = (from a in db.usp_GetAppointmentsByDay(apptDate) select new ApptModel { StartTime = (DateTime)a.StartTime, EndTime = (DateTime)a.EndTime }).ToList(); return(appts); } }
static List <SlotModel> GetSlots(int duration) { using (SlotsTableEntities db = new SlotsTableEntities()) { List <SlotModel> slots = new List <SlotModel>(); slots = (from a in db.usp_GetAppointmentSlots(new TimeSpan(6, 0, 0), new TimeSpan(20, 0, 0), duration, DateTime.Now) select new SlotModel { StartSlot = (DateTime)a.start, EndSlot = (DateTime)a.end, }).ToList(); slots = slots.Where(x => x.StartSlot.TimeOfDay >= DateTime.Now.TimeOfDay).ToList(); return(slots); } }