예제 #1
0
        public void CreateTimeSlot(TimeSlotModel newTimeSlot)
        {
            // map Logic model to DTO
            TimeSlotDTO newTimeSlotDTO = new TimeSlotDTO
            {
                BusinessId    = newTimeSlot.BusinessId,
                DayOTWeek     = newTimeSlot.DayOTWeek,
                StartTime     = newTimeSlot.StartTime,
                EndTime       = newTimeSlot.EndTime,
                NumberOfSpots = newTimeSlot.NumberOfSpots
            };


            _timeSlotCollectionDAL.CreateTimeSlot(newTimeSlotDTO);
        }
예제 #2
0
        public IEnumerable <TimeSlotModel> GetTimeSlotByDayAndBusinessId(DateTime date, string day, int businessId)
        {
            IEnumerable <TimeSlotDTO> timeSlotDTOs = _timeSlotCollectionDAL.GetTimeSlotByDayAndBusinessId(date, day, businessId);

            try
            {
                foreach (var timeslotDTO in timeSlotDTOs)
                {
                    TimeSlotModel timeSlot = new TimeSlotModel(timeslotDTO);
                    timeSlots.Add(timeSlot);
                }
                return(timeSlots);
            }
            catch
            {
                return(timeSlots);
            }
        }
예제 #3
0
        public IEnumerable <TimeSlotModel> GetTimeSlotById(int id)
        {
            // Load in the TimeSlotDTOs into IEnumerable
            IEnumerable <TimeSlotDTO> timeSlotDTOs = _timeSlotCollectionDAL.GetTimeSlotById(id);

            // Map DTO to LogicModel and put into collection list
            try
            {
                foreach (var timeSlotDTO in timeSlotDTOs)
                {
                    TimeSlotModel timeSlot = new TimeSlotModel(timeSlotDTO);
                    timeSlots.Add(timeSlot);
                }
                return(timeSlots);
            }
            catch
            {
                return(timeSlots);
            }
        }