public IHttpActionResult Putproduct(int id, product product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != product.product_id) { return(BadRequest()); } db.Entry(product).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!productExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Putstock(int id, StockVM stock) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stock.store_id) { return(BadRequest()); } db.Entry(stock).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!stockExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Putorder_items(int id, order_items order_items) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != order_items.order_id) { return(BadRequest()); } db.Entry(order_items).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!order_itemsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Putcustomer(int id, customer customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customer.customer_id) { return(BadRequest()); } db.Entry(customer).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!customerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public static void UpdateCustomers(customers customers) { using (BikeStoresEntities db = new BikeStoresEntities()) { db.customers.Add(customers); db.Entry(customers).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "brand_id,brand_name")] brand brand) { if (ModelState.IsValid) { db.Entry(brand).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(brand)); }
public ActionResult Edit([Bind(Include = "customer_id,first_name,last_name,phone,email,street,city,state,zip_code")] customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "category_id,category_name")] category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "store_id,store_name,phone,email,street,city,state,zip_code")] store store) { if (ModelState.IsValid) { db.Entry(store).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(store)); }
public ActionResult Edit([Bind(Include = "order_id,item_id,product_id,quantity,list_price,discount")] order_items order_items) { if (ModelState.IsValid) { db.Entry(order_items).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.product_id = new SelectList(db.products, "product_id", "product_name", order_items.product_id); ViewBag.order_id = new SelectList(db.orders, "order_id", "order_id", order_items.order_id); return(View(order_items)); }
public ActionResult Edit([Bind(Include = "store_id,product_id,quantity")] stock stock) { if (ModelState.IsValid) { db.Entry(stock).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.product_id = new SelectList(db.products, "product_id", "product_name", stock.product_id); ViewBag.store_id = new SelectList(db.stores, "store_id", "store_name", stock.store_id); return(View(stock)); }
public ActionResult Edit([Bind(Include = "product_id,product_name,brand_id,category_id,model_year,list_price")] product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.brand_id = new SelectList(db.brands, "brand_id", "brand_name", product.brand_id); ViewBag.category_id = new SelectList(db.categories, "category_id", "category_name", product.category_id); return(View(product)); }
public ActionResult Edit([Bind(Include = "staff_id,first_name,last_name,email,phone,active,store_id,manager_id")] staff staff) { if (ModelState.IsValid) { db.Entry(staff).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.manager_id = new SelectList(db.staffs, "staff_id", "first_name", staff.manager_id); ViewBag.store_id = new SelectList(db.stores, "store_id", "store_name", staff.store_id); return(View(staff)); }
public ActionResult Edit([Bind(Include = "order_id,customer_id,order_status,order_date,required_date,shipped_date,store_id,staff_id")] order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.customer_id = new SelectList(db.customers, "customer_id", "first_name", order.customer_id); ViewBag.staff_id = new SelectList(db.staffs, "staff_id", "first_name", order.staff_id); ViewBag.store_id = new SelectList(db.stores, "store_id", "store_name", order.store_id); return(View(order)); }
public static void DeleteCustomers(int customer_id) { using (BikeStoresEntities db = new BikeStoresEntities()) { var customers = new DataAccess.customers { customer_id = customer_id }; db.customers.Attach(customers); //db.customers.Remove(customers); db.Entry(customers).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } }