Пример #1
0
        public JsonResult GetById(int id)
        {
            var dbSeries = _seriesService.GetById(id);

            if (dbSeries == null)
            {
                return(ErrorResponse("Not found"));
            }

            return(SingleResult(SeriesViewModelHelpers.ConvertToViewModel(dbSeries)));
        }
Пример #2
0
        public JsonResult GetByName(string seriesName)
        {
            if (string.IsNullOrWhiteSpace(seriesName))
            {
                return(ErrorResponse("Series name is required"));
            }

            var series = _seriesService.GetByName(seriesName);

            if (series == null)
            {
                return(ErrorResponse("No Series found"));
            }

            return(SingleResult(SeriesViewModelHelpers.ConvertToViewModel(series)));
        }