// PUT api/<controller>/5 public object Put(string userid, Login u) { try { if (userid == u.Userid) { lg.Entry(u).State = System.Data.Entity.EntityState.Modified; lg.SaveChanges(); return(new Response { Status = "Updated", }); } else { return(new Response { Status = "opps", }); } } catch (Exception e) { Console.Write("error"); } return(new Response { Status = "Error", }); }
public ActionResult Edit([Bind(Include = "no,product_id,product_name,quantity,unit_price,stored_date")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public static bool CRUDCustomer(Customer customer, EntityState state) { using (StoreManagementEntities store = new StoreManagementEntities()) { if (state == EntityState.Deleted) { customer.RegistrationStatus = (byte)RegistrationStatus.Passive; store.Entry(customer).State = EntityState.Modified; } else { store.Entry(customer).State = state; customer.RegistrationStatus = (byte)RegistrationStatus.Active; } if (store.SaveChanges() > 0) { return(true); } return(false); } }
public void Update(User update) { try { _DbContext.Entry(update).State = System.Data.Entity.EntityState.Modified; _DbContext.SaveChanges(); } catch (Exception ex) { throw ex; } }
public static bool CRUDSale(Sale sale, EntityState state) { using (StoreManagementEntities store = new StoreManagementEntities()) { store.Entry(sale).State = state; if (store.SaveChanges() > 0) { return(true); } return(false); } }
public static bool ChangeUserPassword(User user) { using (StoreManagementEntities store = new StoreManagementEntities()) { store.Entry(user).State = EntityState.Modified; if (store.SaveChanges() > 0) { return(true); } return(false); } }
public void Update(User update) { if (update != null) { try { _Context.Entry(update).State = EntityState.Modified; _Context.SaveChanges(); } catch (Exception ex) { throw ex; } } }
public async Task <ActionResult> Edit([Bind(Include = "ProductID,Name,Price,CreateDate,ModifyDate,InStock")] Products products) { if (ModelState.IsValid) { db.Entry(products).State = EntityState.Modified; products.CreateDate = System.DateTime.Now; products.ModifyDate = System.DateTime.Now; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(products)); }
public static bool CRUDProduct(Product product, EntityState state) { using (StoreManagementEntities store = new StoreManagementEntities()) { if (state == EntityState.Deleted) { product.RegistrationStatus = (byte)RegistrationStatus.Passive; } else { store.Entry(product).State = state; product.RegistrationStatus = (byte)RegistrationStatus.Active; } if (store.SaveChanges() > 0) { return(true); } return(false); } }
public void UpdateCustomer(Customer customer) { DbContext.Entry(customer).State = EntityState.Modified; }
public JsonResult AddProduct(Product product) { StoreManagementEntitiesdb.Entry(product).State = EntityState.Added; return(Json(StoreManagementEntitiesdb.SaveChanges())); }
public virtual void UpdateRecord(T entity) { Dbcontext.Entry(entity).State = EntityState.Modified; }
public JsonResult AddStore(Store store) { StoreManagementEntitiesdb.Entry(store).State = EntityState.Added; return(Json(StoreManagementEntitiesdb.SaveChanges())); }
public JsonResult AddCustomer(Customer customer) { //StoreManagementEntitiesdb.Customers.Add(customer); StoreManagementEntitiesdb.Entry(customer).State = EntityState.Added; return(Json(StoreManagementEntitiesdb.SaveChanges())); }
public JsonResult UpdateSale(ProductSold psold) { StoreManagementEntitiesdb.Entry(psold).State = EntityState.Modified; return(Json(StoreManagementEntitiesdb.SaveChanges())); }