public IActionResult Create([FromBody] Book book)
 {
     try
     {
         return(Ok(_book.Create(book)));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e));
     }
 }
Exemple #2
0
 public IActionResult Create([FromForm] BookDataWithFile model)
 {
     try
     {
         if (model != null)
         {
             var x = _book.Create(model);
             return(Json(x));
         }
         else
         {
             return(Json(model));
         }
     }
     catch (Exception ex)
     {
         return(StatusCode(409, $"{ex.Message}"));
     }
 }