public ActionResult Edit([Bind(Include = "SellerId,SellerName,SellerAddressId")] SELLER sELLER) { if (ModelState.IsValid) { db.Entry(sELLER).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SellerAddressId = new SelectList(db.ADDRESSes, "AddressId", "AddressLine1", sELLER.SellerAddressId); return(View(sELLER)); }
public ActionResult AddSeller(SELLER model) { if (ModelState.IsValid) { model.SellerAddressId = Convert.ToInt32(Session["ID"]); _db.SELLERs.Add(model); _db.SaveChanges(); return(RedirectToAction("Index", "AdminHome")); } return(View(model)); }
// GET: AdminSeller/Delete/5 public ActionResult Delete(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SELLER sELLER = db.SELLERs.Find(id); if (sELLER == null) { return(HttpNotFound()); } return(View(sELLER)); }
// bubbleSort - Sorterar genom att jämföra försäljnings siffror och byter plats. static void bubbleSort(long holder, SELLER[] SellerDB) { for (int i = 0; i < holder; i++) { for (int j = 0; j < holder - 1; j++) { if (SellerDB[j].sales < SellerDB[j + 1].sales) { SELLER placeholder = SellerDB[j]; SellerDB[j] = SellerDB[j + 1]; SellerDB[j + 1] = placeholder; } } // For int J } // For int i } // bubbleSort
// GET: AdminSeller/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SELLER sELLER = db.SELLERs.Find(id); if (sELLER == null) { return(HttpNotFound()); } ViewBag.SellerAddressId = new SelectList(db.ADDRESSes, "AddressId", "AddressLine1", sELLER.SellerAddressId); return(View(sELLER)); }
public void CheckProducts(SELLER sell) { switch (sell) { case SELLER.LINKS: ret = new LINKS(); break; case SELLER.KING: ret = new KING(); break; case SELLER.MSAN: ret = new MSAN(); break; } ret.GetPC(); }
public ActionResult DeleteConfirmed(long id) { SELLER seller = db.SELLERs.Find(id); while (true) //To delete the product related to the seller { var product = db.PRODUCTs.Where(p => p.ProductSellerId == seller.SellerId).FirstOrDefault(); if (product == null) { break; } //return Redirect("/AdminProductView/Delete/" + product.ProductId); PRODUCTDESCRIPTION productDescrption = db.PRODUCTDESCRIPTIONs.Where(d => d.ProductId == product.ProductId).FirstOrDefault(); if (productDescrption != null) { db.PRODUCTDESCRIPTIONs.Remove(productDescrption); } while (true) { PRODUCTPICTURE productPicture = db.PRODUCTPICTUREs.Where(d => d.ProductId == product.ProductId).FirstOrDefault(); if (productPicture == null) { break; } db.PRODUCTPICTUREs.Remove(productPicture); db.SaveChanges(); } db.PRODUCTs.Remove(product); db.SaveChanges(); //finish } var count = db.SELLERs.Where(a => a.SellerAddressId == seller.SellerAddressId).Count(); //To check if the multiple seller beelong to that address if (count == 1) //if only on seller belong to that address then delete the address with the seller { ADDRESS address = db.ADDRESSes.Where(a => a.AddressId == seller.SellerAddressId).FirstOrDefault(); db.ADDRESSes.Remove(address); } db.SELLERs.Remove(seller); db.SaveChanges(); return(RedirectToAction("Index")); }
static void Main() { // I syfte att ge provision måste vi veta hur mycket minne skall reserveras Console.WriteLine("\nHur många försäljare?"); // Håller koll på antal long holder = Convert.ToInt64(Console.ReadLine()); // Array med säljare och en array för att hålla koll på bonussystemet SELLER[] SellerDB = new SELLER[holder]; int[] bonusDB = new int[4]; // Söker igenom m.h.a get for (int i = 0; i < holder; i++) { SellerDB[i] = getSeller(); } bubbleSort(holder, SellerDB); bonusCheck(holder, SellerDB, bonusDB); Printer(holder, SellerDB, bonusDB); } // Main