Example #1
0
        public IHttpActionResult GetBook(string id)
        {
            Book   book    = null;
            string message = "ok";

            try
            {
                book = bookRepository.FindBook(id);
                //db.Books.Find(id);
                if (book == null)
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            return(Ok(new { list = book, message = message }));
        }