Пример #1
0
 public IActionResult Create([FromBody] LawsEntity model)
 {
     try
     {
         if (model != null)
         {
             _laws.Create(model);
         }
         return(Json(model));
     }
     catch (Exception ex)
     {
         _logger.LogCritical($"Exception while get list of items.", ex);
         return(StatusCode(500, $"Exception while get list of items. {ex.Message}"));
     }
 }
Пример #2
0
 public IActionResult Update(Guid id, [FromBody] LawsEntity model)
 {
     try
     {
         if (id == null)
         {
             return(StatusCode(400, $"ID is not valid."));
         }
         else
         {
             var res = _laws.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}"));
     }
 }