public async Task <IActionResult> PutProduct(int id, Product product) { if (id != product.Id) { return(BadRequest()); } _context.Entry(product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutRequestLine(int id, RequestLine requestLine) { if (id != requestLine.Id) { return(BadRequest()); } _context.Entry(requestLine).State = EntityState.Modified; try { await _context.SaveChangesAsync(); //call recalculate var success = RecalculateRequestTotal(id); if (!success) { return(this.StatusCode(500)); } } catch (DbUpdateConcurrencyException) { if (!RequestLineExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutVendors(int id, Vendors vendors) { if (id != vendors.Id) { return(BadRequest()); } _context.Entry(vendors).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }