public IActionResult GetAllPublishers()
 {
     try
     {
         var _result = _publishersService.GetAllPublishers();
         return(Ok(_result));
     }
     catch (System.Exception)
     {
         return(BadRequest("Sorry, we could not load the publishers"));
     }
 }
        public IActionResult GetAllPublishers(string sortBy, string searchString, int pageNumber)
        {
            try {
                _logger.LogInformation("this is just a log in GetAllPublishers()");
                var _result = _publishersService.GetAllPublishers(sortBy, searchString, pageNumber);

                return(Ok(_result));
            } catch (Exception) {
                return(BadRequest("Sorry, We could not load Publishers"));
            }
        }
示例#3
0
 public IActionResult GetAllPublishers(string sortBy, string searchString, int pageNumber)
 {
     //var _result = _publishersService.GetAllPublishers();
     //return Ok(_result);
     try
     {
         var _result = _publishersService.GetAllPublishers(sortBy, searchString, pageNumber);
         return(Ok(_result));
     }
     catch (Exception)
     {
         return(BadRequest("Sorry, we could not load the publishers"));
     }
 }
        public IActionResult GetAllPublishers(string sortBy, string searchString, int pageNumber)
        {
            // throw new Exception("This is an exception thrown from GetAllPublishers()");

            try
            {
                _logger.LogInformation("This is just a log in GetAllPublishers() ");

                var _result = _publishersService.GetAllPublishers(sortBy, searchString, pageNumber);
                return(Ok(_result));
            }
            catch (Exception ex)
            {
                var xx = ex.Message;
                return(BadRequest("Sorry, we could not load the publishers "));
            }
        }
        public void GetAllPublishers_WithNoSortBy_WithNoSearchString_WithNoPageNumber_Test()
        {
            var result = publisherService.GetAllPublishers("", "", null);

            Assert.That(result.Count, Is.EqualTo(5));
        }