Beispiel #1
0
 public Book Get(int id)
 {
     try
     {
         return(_booksProvider.GetBook(id));
     }
     catch
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
     }
 }
Beispiel #2
0
        public IHttpActionResult Get(string code)
        {
            try
            {
                var book = _booksProvider.GetBook(code);
                if (book == null)
                {
                    return(NotFound());
                }

                return(Ok(book));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public void GetBook()
        {
            var book = _booksProvider.GetBook("NET-0001");

            Assert.IsTrue(book != null);
        }
 // GET: api/Books/5
 public Book Get(int id)
 {
     return(_booksProvider.GetBook(id));
 }