public async Task <IActionResult> PutTacos(int id, Tacos tacos) { if (id != tacos.IdTacos) { return(BadRequest()); } _context.Entry(tacos).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TacosExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tacos> > PostTacos(Tacos tacos) { _context.Tacos.Add(tacos); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTacos", new { id = tacos.IdTacos }, tacos)); }
public async Task <ActionResult <Tacos> > GetTacos(int id) { Tacos tacos = await _context.Tacos.FindAsync(id); if (tacos == null) { return(NotFound()); } return(tacos); }
public async Task <ActionResult <Tacos> > DeleteTacos(int id) { Tacos tacos = await _context.Tacos.FindAsync(id); if (tacos == null) { return(NotFound()); } _context.Tacos.Remove(tacos); await _context.SaveChangesAsync(); return(tacos); }