コード例 #1
0
        public Task <HttpResponseMessage> Post([FromBody] dynamic body)
        {
            HttpResponseMessage ResponseMessage;

            try
            {
                var conteudo = (string)body.conteudo;
                var retorno  = explorador.Iniciar(conteudo);

                if (especificacaoDeNegocio.HouveViolacao())
                {
                    ResponseMessage = Request.CreateResponse(HttpStatusCode.BadRequest, new { errors = especificacaoDeNegocio.RegrasDeNegocio.ToList() });
                }
                else
                {
                    ResponseMessage = Request.CreateResponse(HttpStatusCode.Created, retorno);
                }
            }
            catch (Exception error)
            {
                ResponseMessage = Request.CreateResponse(HttpStatusCode.BadRequest, new { errors = error.Message });
            }

            return(Task.FromResult <HttpResponseMessage>(ResponseMessage));
        }
コード例 #2
0
        public Task <HttpResponseMessage> Post([FromBody] dynamic body)
        {
            var conteudo = (string)body.conteudo;

            var retorno = explorador.Iniciar(conteudo);

            QuebraDeEspeficacao = explorador.RegrasNegocio;

            return(CreateResponse(System.Net.HttpStatusCode.Created, retorno));
        }