public ActionResult Create([Bind(Include = "ColorID,ColorName")] Color color) { if (ModelState.IsValid) { db.Colors.Add(color); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(color)); }
public ActionResult Create([Bind(Include = "OccasionID,OccasionName")] Occasion occasion) { if (ModelState.IsValid) { db.Occasions.Add(occasion); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(occasion)); }
public ActionResult Create([Bind(Include = "SeasonID,SeasonName")] Season season) { if (ModelState.IsValid) { db.Seasons.Add(season); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(season)); }
public ActionResult Create([Bind(Include = "ShoeID,Name,Photo,ColorID,SeasonID,OccasionID")] Shoe shoe) { if (ModelState.IsValid) { db.Shoes.Add(shoe); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ColorID = new SelectList(db.Colors, "ColorID", "ColorName", shoe.ColorID); ViewBag.OccasionID = new SelectList(db.Occasions, "OccasionID", "OccasionName", shoe.OccasionID); ViewBag.SeasonID = new SelectList(db.Seasons, "SeasonID", "SeasonName", shoe.SeasonID); return(View(shoe)); }
public ActionResult Create([Bind(Include = "AccessoryID,Name,Photo,ColorID,SeasonID,OccasionID")] Accessory accessory) { if (ModelState.IsValid) { db.Accessories.Add(accessory); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ColorID = new SelectList(db.Colors, "ColorID", "ColorName", accessory.ColorID); ViewBag.OccasionID = new SelectList(db.Occasions, "OccasionID", "OccasionName", accessory.OccasionID); ViewBag.SeasonID = new SelectList(db.Seasons, "SeasonID", "SeasonName", accessory.SeasonID); return(View(accessory)); }
public ActionResult Create([Bind(Include = "BottomID,Name,Photo,ColorID,SeasonID,OccasionID")] Bottom bottom) { if (ModelState.IsValid) { db.Bottoms.Add(bottom); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ColorID = new SelectList(db.Colors, "ColorID", "ColorName", bottom.ColorID); ViewBag.OccasionID = new SelectList(db.Occasions, "OccasionID", "OccasionName", bottom.OccasionID); ViewBag.SeasonID = new SelectList(db.Seasons, "SeasonID", "SeasonName", bottom.SeasonID); return(View(bottom)); }
public ActionResult Create([Bind(Include = "TopID,Name,Photo,ColorID,SeasonID,OccasionID")] Top top) { if (ModelState.IsValid) { db.Tops.Add(top); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ColorID = new SelectList(db.Colors, "ColorID", "ColorName", top.ColorID); ViewBag.OccasionID = new SelectList(db.Occasions, "OccasionID", "OccasionName", top.OccasionID); ViewBag.SeasonID = new SelectList(db.Seasons, "SeasonID", "SeasonName", top.SeasonID); return(View(top)); }
public ActionResult Create([Bind(Include = "OutfitID,TopID,BottomID,ShoeID,AccessoryID")] Outfit outfit) { if (ModelState.IsValid) { db.Outfits.Add(outfit); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccessoryID = new SelectList(db.Accessories, "AccessoryID", "Name", outfit.AccessoryID); ViewBag.BottomID = new SelectList(db.Bottoms, "BottomID", "Name", outfit.BottomID); ViewBag.ShoeID = new SelectList(db.Shoes, "ShoeID", "Name", outfit.ShoeID); ViewBag.TopID = new SelectList(db.Tops, "TopID", "Name", outfit.TopID); return(View(outfit)); }
public ActionResult Create([Bind(Include = "OutfitID,TopID,BottomID,ShoeID")] Outfit outfit, List <int> SelectedAccessories) { if (ModelState.IsValid) { foreach (int accessoryID in SelectedAccessories) { outfit.Accessory.Add(db.Accessories.Find(accessoryID)); } db.Outfits.Add(outfit); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BottomID = new SelectList(db.Bottoms, "BottomID", "Name", outfit.BottomID); ViewBag.ShoeID = new SelectList(db.Shoes, "ShoeID", "Name", outfit.ShoeID); ViewBag.TopID = new SelectList(db.Tops, "TopID", "Name", outfit.TopID); //ViewBag.Accessory = new SelectList(db.Accessories, "Accessories", "Name", outfit.Accessory) return(View(outfit)); }
public void Save() { context.SaveChanges(); }