示例#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);
            }
        }