public ActionResult Create(Userinfo userinfo) { if (ModelState.IsValid) { db.Userinfoes.AddObject(userinfo); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CakeID = new SelectList(db.Cakes, "CakeID", "CakeName", userinfo.CakeID); return View(userinfo); }
public ActionResult Edit(Userinfo userinfo) { if (ModelState.IsValid) { db.Userinfoes.Attach(userinfo); db.ObjectStateManager.ChangeObjectState(userinfo, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CakeID = new SelectList(db.Cakes, "CakeID", "CakeName", userinfo.CakeID); return View(userinfo); }
/// <summary> /// Create a new Userinfo object. /// </summary> /// <param name="id">Initial value of the ID property.</param> public static Userinfo CreateUserinfo(global::System.Int32 id) { Userinfo userinfo = new Userinfo(); userinfo.ID = id; return userinfo; }
/// <summary> /// Deprecated Method for adding a new object to the Userinfoes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUserinfoes(Userinfo userinfo) { base.AddObject("Userinfoes", userinfo); }