public static BeginPresentationModel CreateFromPresentation(Presentation presentation) { var presentationModel = new BeginPresentationModel(); presentationModel.About = presentation.About; presentationModel.PresentationId = presentation.PresentationId; presentationModel.PresentationName = presentation.Name; presentationModel.TimeOfCreate = presentation.DateOfCreate; presentationModel.UserId = presentation.UserId; return presentationModel; }
/// <summary> /// Create a new Presentation object. /// </summary> /// <param name="presentationId">Initial value of the PresentationId property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="about">Initial value of the About property.</param> /// <param name="dateOfCreate">Initial value of the DateOfCreate property.</param> /// <param name="userId">Initial value of the UserId property.</param> public static Presentation CreatePresentation(global::System.Guid presentationId, global::System.String name, global::System.String about, global::System.DateTime dateOfCreate, global::System.Guid userId) { Presentation presentation = new Presentation(); presentation.PresentationId = presentationId; presentation.Name = name; presentation.About = about; presentation.DateOfCreate = dateOfCreate; presentation.UserId = userId; return presentation; }
public ActionResult NewPresentation(BeginPresentationModel newPresentation) { if (Request.IsAuthenticated) { var db = new SimPresEntities(); var currentUser = db.Users.SingleOrDefault<User>(x => x.Login == User.Identity.Name); if (currentUser != null) { newPresentation.UserId = currentUser.UserId; newPresentation.PresentationId = Guid.NewGuid(); var currentPresentation = new Presentation() { DateOfCreate = DateTime.Now, About = newPresentation.About, Name = newPresentation.PresentationName, PresentationId = newPresentation.PresentationId, UserId = newPresentation.UserId }; db.Presentations.AddObject(currentPresentation); db.SaveChanges(); TempData.Add("currentPresentationId", currentPresentation.PresentationId); return RedirectToAction("CreateSlide", "Presentation"); } else { return RedirectToAction("Index", "Home"); } } return View(); }
/// <summary> /// Deprecated Method for adding a new object to the Presentations EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPresentations(Presentation presentation) { base.AddObject("Presentations", presentation); }