Exemplo n.º 1
0
 public ActionResult <Consumo> Get(int id)
 {
     return(Ok(new
     {
         status = "200",
         msg = "OK",
         obj = repository.GetByID(id)
     }));
 }
        public ActionResult Post([FromBody] Restaurante entity)
        {
            var consumo = consumoRepository.GetByID(entity.idconsumo);

            if (consumo != null)
            {
                entity.consumo = consumo;
            }

            repository.Create(entity);

            return(Ok(new
            {
                status = "200",
                msg = "OK",
                obj = entity
            }));
        }
 public IActionResult View(int id)
 {
     ViewBag.Restaurantes = restauranteRepository.GetAll();
     return(View(consumoRepository.GetByID(id)));
 }