public ActionResult Get(int id)
 {
     try
     {
         var book = bookData.GetBook(id);
         if (book != null)
         {
             return(Ok(book));
         }
         return(NotFound($"Book with Id: {id} was not found"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message.Contains("inner") ? ex.InnerException.Message : ex.Message));
     }
 }
示例#2
0
        public void OnGet(string SearchTerm)
        {
            SearchModel.ISBN       = SearchTerm;
            SearchModel.Naslov     = SearchTerm;
            SearchModel.Opis       = SearchTerm;
            SearchModel.Avtor      = SearchTerm;
            SearchModel.Oznaka     = SearchTerm;
            SearchModel.Izdajatelj = SearchTerm;
            SearchModel.LetoIzdaje = SearchTerm;
            Console.WriteLine("SEARCHMODEL " + SearchModel.Naslov);

            Books = bookData.GetBook(SearchModel);
        }