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}")); } }
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}")); } }