public async Task <ActionResult <StateBuy> > PostStateBuy(StateBuy stateBuy) { _context.StateBuy.Add(stateBuy); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStateBuy", new { id = stateBuy.StateBuyId }, stateBuy)); }
public async Task <IActionResult> PutStateBuy(int id, StateBuy stateBuy) { if (id != stateBuy.StateBuyId) { return(BadRequest()); } _context.Entry(stateBuy).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StateBuyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }