Esempio n. 1
0
        public IActionResult Get(int locationId, GetLocationSchedulesParameters parameters)
        {
            if (!parameters.StartDate.HasValue)
            {
                parameters.StartDate = _dateTimeProvider.CurrentDateTime.Date;
            }

            if (!parameters.EndDate.HasValue)
            {
                parameters.EndDate = parameters.StartDate.Value.AddDays(7).Date;
            }

            var result = _scheduleService.GetSchedulesForLocation(locationId,
                                                                  parameters.StartDate.Value, parameters.EndDate.Value);

            return(CreateResponse <List <Schedule>, List <LocationScheduleModel> >(result));
        }
Esempio n. 2
0
        public IActionResult Get(int locationId, GetLocationSchedulesParameters parameters)
        {
            if (!parameters.StartDate.HasValue)
            {
                parameters.StartDate = this.dateTimeProvider.CurrentDateTime.Date;
            }

            if (!parameters.EndDate.HasValue)
            {
                parameters.EndDate = parameters.StartDate.Value.AddDays(7).Date;
            }

            List <Schedule> schedules = scheduleService.GetSchedulesForLocation(locationId,
                                                                                parameters.StartDate.Value, parameters.EndDate.Value);

            List <LocationScheduleModel> models = this.mapper.Map <List <Schedule>, List <LocationScheduleModel> >(schedules);

            return(Ok(models));
        }