public IActionResult Put(int id, [FromBody] TpDoce TpDoce) { if (_dbSet.Any(o => o.Id == id)) { TpDoce.Id = id; _dbSet.Update(TpDoce); _agendaDbContext.SaveChanges(); return(Ok()); } return(NoContent()); }
public IActionResult Post([FromBody] TpDoce TpDoce) { try { TpDoce.Id = 0; _dbSet.Add(TpDoce); _agendaDbContext.SaveChanges(); return(Ok()); } catch (System.Exception) { return(StatusCode(500, new { msg = "Erro ao executar operação" })); } }