예제 #1
0
 public ActionResult Create(Restaurante restaurante)
 {
     if (ModelState.IsValid)
     {
         _db.Add(restaurante);
         return(RedirectToAction("Details", new { id = restaurante.Id }));
     }
     return(View());
 }
예제 #2
0
        public object Post(Restaurante restaurante)
        {
            if (restaurante != null)
            {
                _db.Add(restaurante);

                retornoApi = new
                {
                    status   = "1",
                    mensagem = "Sucesso",
                    restauranteAdicionado = restaurante
                };

                return(retornoApi);
            }
            retornoApi = new
            {
                status   = "-1",
                mensagem = "Error",
            };

            return(retornoApi);
        }