public async Task <IHttpActionResult> CrearParametro([FromBody] ParametroView param) { #region Validaciones if (param == null) { var error = LocalizedText.TodosParametrosRequerido; var message = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(JsonConvert.SerializeObject(new { type = KeysConfiguration.ErrorBusinessValidation, message = error })) }; message.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); throw new HttpResponseException(message); } #endregion #region Proceso var result = await _model.CrearParametro(param); if (result.HasErrors) { var error = result.Errors.FirstOrDefault(); var message = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(JsonConvert.SerializeObject(new { type = error.Code, message = error.Message })) }; message.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); throw new HttpResponseException(message); } if (result.Data == null) { return(NotFound()); } return(Ok(result.Data)); #endregion }