Esempio n. 1
0
        public virtual async Task <IActionResult> Patch(int id, [FromBody] JsonPatchDocument <ApiCreditCardRequestModel> patch)
        {
            ApiCreditCardResponseModel record = await this.CreditCardService.Get(id);

            if (record == null)
            {
                return(this.StatusCode(StatusCodes.Status404NotFound));
            }
            else
            {
                ApiCreditCardRequestModel model = await this.PatchModel(id, patch);

                UpdateResponse <ApiCreditCardResponseModel> result = await this.CreditCardService.Update(id, model);

                if (result.Success)
                {
                    return(this.Ok(result));
                }
                else
                {
                    return(this.StatusCode(StatusCodes.Status422UnprocessableEntity, result));
                }
            }
        }