public ActionResult Edit(Presentation presentation) { if (ModelState.IsValid) { db.Presentation.Attach(presentation); db.ObjectStateManager.ChangeObjectState(presentation, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.UserId = new SelectList(db.User, "Id", "Name", presentation.UserId); return View(presentation); }
public ActionResult Create(Presentation presentation) { if (ModelState.IsValid) { db.Presentation.AddObject(presentation); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.UserId = new SelectList(db.User, "Id", "Name", presentation.UserId); return View(presentation); }
/// <summary> /// Create a new Presentation object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="publishTime">Initial value of the PublishTime property.</param> /// <param name="link">Initial value of the Link property.</param> /// <param name="isActive">Initial value of the IsActive property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="mark">Initial value of the Mark property.</param> public static Presentation CreatePresentation(global::System.Int32 id, global::System.Int32 userId, global::System.DateTime publishTime, global::System.String link, global::System.Boolean isActive, global::System.String name, global::System.Int32 mark) { Presentation presentation = new Presentation(); presentation.Id = id; presentation.UserId = userId; presentation.PublishTime = publishTime; presentation.Link = link; presentation.IsActive = isActive; presentation.Name = name; presentation.Mark = mark; return presentation; }
/// <summary> /// Deprecated Method for adding a new object to the Presentation EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPresentation(Presentation presentation) { base.AddObject("Presentation", presentation); }