public IActionResult Patch(Guid id, [FromBody] GroceryMeaninglessWord model) { this.logger.LogDebug(this.localizer["LogPatchGroceryMeaninglessWordsTry"].Value); UpdateResult result; try { result = this.groceryMeaninglessWordService.UpdatePartially(id, model); } catch (Exception ex) { this.logger.LogError(ex, this.localizer["LogPatchGroceryMeaninglessWordsError"].Value); return(this.Problem( statusCode: (int)HttpStatusCode.InternalServerError, title: ex.ToString(), detail: ex.StackTrace)); } if (result == null) { this.logger.LogWarning(string.Format(CultureInfo.InvariantCulture, this.localizer["LogPatchGroceryMeaninglessWordsNotFound"].Value)); return(this.NotFound(string.Format(CultureInfo.InvariantCulture, this.localizer["LogPatchGroceryMeaninglessWordsNotFound"].Value))); } this.logger.LogDebug(this.localizer["LogPatchGroceryMeaninglessWordsSuccess"].Value); return(this.Ok(result)); }
public IActionResult Post([FromBody] GroceryMeaninglessWord model) { this.logger.LogDebug(this.localizer["LogPostGroceryMeaninglessWordsTry"].Value); GroceryMeaninglessWord result; try { result = this.groceryMeaninglessWordService.Create(model); } catch (Exception ex) { this.logger.LogError(ex, this.localizer["LogPostGroceryMeaninglessWordsError"].Value); return(this.Problem( statusCode: (int)HttpStatusCode.InternalServerError, title: ex.ToString(), detail: ex.StackTrace)); } if (result == null) { this.logger.LogWarning(string.Format(CultureInfo.InvariantCulture, this.localizer["LogPostGroceryMeaninglessWordsNotFound"].Value)); return(this.NotFound(string.Format(CultureInfo.InvariantCulture, this.localizer["LogPostGroceryMeaninglessWordsNotFound"].Value))); } this.logger.LogDebug(this.localizer["LogPostGroceryMeaninglessWordsSuccess"].Value); return(this.Created(new Uri(this.appSettings.Environment.BackUrl, $"api/grocerymeaninglesswords/{model?.Id}"), result)); }