Example #1
0
        private async Task <Book> GetByIdAsync(int id)
        {
            var book = await _repository.GetByIdAsync(id);

            if (book == null)
            {
                var message = string.Format(ErrorMessage.NOT_FOUND_FORMAT, id);
                ThrowHttp.NotFound(message);
            }

            return(book);
        }
        private async Task <Author> GetByIdAsync(int id)
        {
            var author = await _repository.GetByIdAsync(id);

            if (author == null)
            {
                var errorMessage = string.Format(ErrorMessage.NOT_FOUND_FORMAT, id);
                ThrowHttp.NotFound(errorMessage);
            }

            return(author);
        }