コード例 #1
0
        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;
        }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
        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();
        }
コード例 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Presentations EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPresentations(Presentation presentation)
 {
     base.AddObject("Presentations", presentation);
 }