private async Task <ActionResult <Auction> > ChangeAuctionStatus(int id, AuctionStatus status) { var auction = await _context.Auction .Where(x => x.ID == id) .FirstOrDefaultAsync(); if (auction == null) { return(NotFound()); } auction.Status = status; _context.Entry(auction).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AuctionExists(id)) { return(NotFound()); } else { throw; } } return(auction); }
public async Task <IActionResult> PutLot(int id, Lot lot) { if (id != lot.ID) { return(BadRequest()); } _context.Entry(lot).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LotExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }