public async Task <IActionResult> Patch(int id, [FromBody] NovelPatchDto value) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id < 0) { throw new ArgumentOutOfRangeException(nameof(id), "Id should be greater than 0."); } var updatedNovel = await _novelsService.UpdateNovel(id, value); return(AcceptedAtRoute("GetNovel", new { id = updatedNovel.Id }, updatedNovel)); } catch (DeepValidationException e) { _logger.LogMethodError(e); ModelState.AddModelError(e.Key, e.Error); return(BadRequest(ModelState)); } catch (Exception e) { _logger.LogMethodError(e); return(BadRequest(e.Message)); } }