Exemplo n.º 1
0
        public async Task <IActionResult> GetServiceByTimetableId(string serviceId, DateTime @on)
        {
            try
            {
                var service = _timetable.GetScheduleByTimetableUid(serviceId, @on);
                if (service.status == LookupStatus.Success)
                {
                    var model = _mapper.Map <Timetable.ResolvedService, Model.Service>(service.service, 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));
            }
        }