public async Task <IActionResult> PutVendor(int id, Vendor vendor) { if (id != vendor.Id) { return(BadRequest()); } _context.Entry(vendor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
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 JSONResponse Change(Vendor vendor) { if (vendor == null) { return(new JSONResponse { Result = "failed", Message = "Failed to create because null" }); } if (!ModelState.IsValid) { return(new JSONResponse { Result = "failed", Message = "Modelstate invalid, see error", Error = ModelState }); } db.Entry(vendor).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(new JSONResponse { Message = "Success", Data = vendor }); }
public JSONResponse Change(PurchaseRequest purchaserequest) { if (purchaserequest == null) { return(new JSONResponse { Result = "failed", Message = "Failed to create because null" }); } if (!ModelState.IsValid) { return(new JSONResponse { Result = "failed", Message = "Modelstate invalid, see error", Error = ModelState }); } db.Entry(purchaserequest).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(new JSONResponse { Message = "Success", Data = purchaserequest }); }
private async Task refreshrequestline(Requestline requestline) { _context.Entry(requestline).State = EntityState.Detached; await _context.Requestline.FindAsync(requestline.Id); }