Exemplo n.º 1
0
        public IActionResult Update(long id, [FromBody] Cerveja cerveja)
        {
            if (cerveja == null || cerveja.Id != id)
            {
                return(BadRequest());
            }

            var cerv = _cervejaRepository.Find(id);

            if (cerv == null)
            {
                return(NotFound());
            }
            cerv.Nome   = cerveja.Nome;
            cerv.Marca  = cerveja.Marca;
            cerv.Tipo   = cerveja.Tipo;
            cerv.Codigo = cerveja.Codigo;
            cerv.Url    = cerveja.Url;

            _cervejaRepository.Update(cerv);
            return(new NoContentResult());
        }
 public void Update(CervejaAggregate.Cerveja cerveja)
 {
     _cervejaRepository.Update(cerveja);
 }