public async Task <IActionResult> PutReceita(long id, Receita receita) { if (id != receita.Id) { return(BadRequest()); } receita.DataDeCadastro = DateTime.Now.ToString("dd/MM/yyyy HH:mm"); _context.Entry(receita).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReceitaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult <Receita> PutReceita(int id, [FromBody] Receita model) { _context.Entry(model).State = EntityState.Modified; _context.SaveChanges(); return(Ok(model)); }