public HttpResponseMessage GetTamanhos()
        {
            try
            {
                var tamanhos = servicoDeAplicacaoDeTamanhos.RecuperarTamanhos();

                return(Request.CreateResponse(HttpStatusCode.OK, conversao.Converter(tamanhos)));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public HttpResponseMessage GetSabores()
        {
            try
            {
                var sabores = servicoDeAplicacaoDeSabores.RecuperarSabores();

                return(Request.CreateResponse(HttpStatusCode.OK, conversao.Converter(sabores)));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public HttpResponseMessage PostPedido(PedidoModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var pedido = conversao.Converter(model);

                    servicoDeAplicacaoDePedido.InserirPedido(pedido);

                    return(Request.CreateResponse(HttpStatusCode.Created, conversao.Converter(pedido)));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }