Beispiel #1
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();
        }
Beispiel #2
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;
        }