public void updateCategory(Category category) { using (var context = new CContext()) { context.Entry(category).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void UpdateProducts(Product product) { using (var context = new CContext()) { context.Entry(product).State = EntityState.Modified; context.SaveChanges(); } }
public void SaveProducts(Product product) { using (var context = new CContext()) { context.Entry(product).State = EntityState.Unchanged; context.Products.Add(product); context.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "RecognitionID,CoreValueTypeID,recognitionDescription,recognitionDate,profileID")] Recognition recognition) { if (ModelState.IsValid) { db.Entry(recognition).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.CoreValueTypeID = new SelectList(db.CoreValueType, "CoreValueTypeID", "CoreValueName", recognition.value); ViewBag.profileID = new SelectList(db.profile, "profileID", "employeeFirstName", recognition.profileID); return(View(recognition)); }
public bool UpdateOrderStatus(int id, string status) { using (var context = new CContext()) { var order = context.Orders.Find(id); order.Status = status; context.Entry(order).State = EntityState.Modified; return(context.SaveChanges() > 0); } }