Exemplo n.º 1
0
        public TvSeriesModel Get(int season)
        {
            try
            {
                Logger.Trace("Begin => Get");
                Logger.DebugFormat("Parameters [season={0}]", season);

                TvSeries result = _tvSeriesRepository.Get(season);

                if (result == null)
                {
                    Logger.DebugFormat("Season season={0} not found", season);
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }

                return TvSeriesModel.CopyFrom(result);
            }
            catch (Exception err)
            {
                Logger.Error("Error in Get", err);
                throw;
            }
            finally
            {
                Logger.Trace("End => Get");
            }
        }
        public IEnumerable <TvSeriesModel> List()
        {
            try
            {
                Logger.Trace("Begin => List");
                IEnumerable <TvSeries> results = _tvSeriesRepository.List();

                if (results == null)
                {
                    Logger.Debug("No Television Seasons found");
                    throw new HttpResponseException(HttpStatusCode.NoContent);
                }

                return(results.Select(t => TvSeriesModel.CopyFrom(t)));
            }
            catch (Exception err)
            {
                Logger.Error("Error in List", err);
                throw;
            }
            finally
            {
                Logger.Trace("End => List");
            }
        }