protected void GeraErro(HttpStatusCode statusCode, Exception ex) { ServiceResult serviceResult = new ServiceResult(); serviceResult.Success = false; serviceResult.Messages.Add(new ServiceResultMessage() { Message = UtilitarioBusiness.RetornaExceptionMessages(ex) }); var json = JsonConvert.SerializeObject(serviceResult); HttpResponseMessage response = this.Request.CreateErrorResponse(statusCode, json); throw new HttpResponseException(response); }
protected void GeraErro(HttpStatusCode statusCode, ServiceResult resultado) { var json = JsonConvert.SerializeObject(resultado); HttpResponseMessage response = this.Request.CreateErrorResponse(statusCode, json); throw new HttpResponseException(response); }
protected void IncluiMensagemSucessoBusiness(string mensagem) { serviceResult = new ServiceResult(); serviceResult.Success = true; serviceResult.Messages.Add(new ServiceResultMessage() { Message = mensagem }); }
protected HttpResponseMessage RetornaMensagemErro(HttpStatusCode statusCode, ServiceResult resultado) { var json = JsonConvert.SerializeObject(resultado); HttpResponseMessage response = this.Request.CreateResponse(statusCode, json); return response; }
protected void LimpaValidacao() { serviceResult = new ServiceResult(); }