Esempio n. 1
0
        public async Task <IActionResult> GetServiceByRetailServiceId(string serviceId, DateTime @on)
        {
            try
            {
                var service = _timetable.GetScheduleByRetailServiceId(serviceId, @on);
                if (service.status == LookupStatus.Success)
                {
                    var model = _mapper.Map <Timetable.ResolvedService[], Model.Service[]>(service.services, InitialiseContext);
                    return(await Task.FromResult(Ok(model)));
                }

                return(await Task.FromResult(CreateNoServiceResponse(service.status, serviceId, @on)));
            }
            catch (Exception e)
            {
                _logger.Error(e, "Error when processing : {serviceId} on {on}", serviceId, on.ToYMD());
                return(CreateNoServiceResponse(LookupStatus.Error, serviceId, @on));
            }
        }