private ClothingData() { //NP : no preference PieceOfClothing blackDenimJacket = new PieceOfClothing("J", "NP", "Black Denim Jacket"); PieceOfClothing denimJacket = new PieceOfClothing("J", "NP", "Blue Denim Jacket"); PieceOfClothing leatherJacket = new PieceOfClothing("J", "NP", "Leather Jacket"); Jackets.Add(blackDenimJacket); Jackets.Add(denimJacket); Jackets.Add(leatherJacket); PieceOfClothing darkBlueCollarShortSleevedShirt = new PieceOfClothing("SSS", "B", "Dark Blue Collared Short Sleeve Shirt"); BSSShirts.Add(darkBlueCollarShortSleevedShirt); BLSShirtsAndBSSShirts.Add(darkBlueCollarShortSleevedShirt); PieceOfClothing lSS1 = new PieceOfClothing("LSS", "B", "Long Sleeved Jean Shirt"); BLSShirtsAndBSSShirts.Add(lSS1); BLSShirts.Add(lSS1); PieceOfClothing tightKahkiPants = new PieceOfClothing("P", "B", "Tight Kahki Pants"); BPants.Add(tightKahkiPants); PieceOfClothing brownDressShoes = new PieceOfClothing("S", "B", "Brown Dress Shoes"); BShoes.Add(brownDressShoes); }
public ActionResult DeleteConfirmed(int id) { Jackets jackets = db.JacketsSet.Find(id); db.JacketsSet.Remove(jackets); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,name,imageUrl,price")] Jackets jackets) { if (ModelState.IsValid) { db.Entry(jackets).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jackets)); }
public ActionResult Create([Bind(Include = "id,name,imageUrl,price")] Jackets jackets) { if (ModelState.IsValid) { db.JacketsSet.Add(jackets); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jackets)); }
// GET: Jackets/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Jackets jackets = db.JacketsSet.Find(id); if (jackets == null) { return(HttpNotFound()); } return(View(jackets)); }
protected override void Seed(CartContext context) { UserEntity user = new UserEntity(); user.UserName = "******"; user.Password = "******"; var item_id = 2; Item item = new Jackets { id = 20, name = "Black Jean Shearling", imageUrl = "https://i.ibb.co/XzcwL5s/black-shearling.png", price = 125 }; var cart = new List <Cart> { new Cart { UserName = user.UserName, itemId = item_id, itemName = item.name, itemImageUrl = item.imageUrl, itemPrice = item.price } }; cart.ForEach(s => context.CartSet.Add(s)); context.SaveChanges(); }