예제 #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);
        }
예제 #2
0
        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);
        }