public ActionResult Create(flower flower) { if (ModelState.IsValid) { db.flowers.AddObject(flower); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.category = new SelectList(db.categories, "Cid", "cName", flower.category); ViewBag.subColor = new SelectList(db.subColors, "id", "subColorName", flower.subColor); return View(flower); }
/// <summary> /// Create a new flower object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="image">Initial value of the image property.</param> public static flower Createflower(global::System.Int32 id, global::System.String name, global::System.String image) { flower flower = new flower(); flower.id = id; flower.Name = name; flower.image = image; return flower; }
/// <summary> /// Deprecated Method for adding a new object to the flowers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToflowers(flower flower) { base.AddObject("flowers", flower); }
public ActionResult Edit(flower flower) { if (ModelState.IsValid) { db.flowers.Attach(flower); db.ObjectStateManager.ChangeObjectState(flower, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.category = new SelectList(db.categories, "Cid", "cName", flower.category); ViewBag.subColor = new SelectList(db.subColors, "id", "subColorName", flower.subColor); return View(flower); }