コード例 #1
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}"));
     }
 }
コード例 #2
0
 public IActionResult Update(Guid id, [FromForm] BookDataWithFile model)
 {
     try
     {
         if (id == null)
         {
             return(StatusCode(400, $"ID is not valid."));
         }
         else
         {
             var res = _book.Update(id, model);
             return(Json(res));
         }
     }
     catch (Exception ex)
     {
         //_logger.LogCritical($"Exception while get list of items.", ex);
         return(StatusCode(500, $"Exception while get list of items. {ex.Message}"));
     }
 }