public async Task <IActionResult> PutSample(int id, Sample sample) { if (id != sample.SampleId) { return(BadRequest()); } _context.Entry(sample).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SampleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "productId,productName,price,stock")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public ActionResult Edit(Supplier supplier) { if (ModelState.IsValid) { db.Entry(supplier).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(supplier)); }
public ActionResult Manage([Bind(Include = "ProjectID,Title,Description,Phase")] Project project) { if (ModelState.IsValid) { db.Entry(project).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(project)); }
public ActionResult Edit([Bind(Include = "CardID,ProjectID,Status,Title,Description")] Card card) { if (ModelState.IsValid) { db.Entry(card).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(card)); }
public T Update(T entity) { T originalEntity = Get(entity.Id); if (originalEntity == null) { return(null); } _context.Entry(originalEntity).CurrentValues.SetValues(entity); //_context.BaseEntitys.Update(originalEntity); _context.SaveChanges(); return(entity); }
public void Update(TEntity entity) { _context.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Modified; }
public async Task Update(T entity) { _pmContext.Entry(entity).State = EntityState.Modified; await _pmContext.SaveChangesAsync(); }