示例#1
0
        public HttpResponseMessage InserirRestaurante(Restaurante restaurante)
        {
            if (restaurante == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            try
            {
                _restauranteService.Inserir(restaurante);

                var result = _restauranteService.BuscarTodos().ToList();
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (Exception)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Falha ao incluir o Restaurante."));
            }
        }