Ejemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            var seminar = LoadSeminar(id);

            if (seminar == null)
            {
                ErrorMessages = string.Format(Messages.NotFound, "Seminar", id);
                return(this.RedirectToAction(a => a.Index()));
            }

            var viewModel = SeminarViewModel.Create(Repository, seminar.Site, seminar);

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public ActionResult Details(int?id)
        {
            var seminar = LoadSeminar(id);

            if (seminar == null)
            {
                ErrorMessages = string.Format(Messages.NotFound, "Seminar", id);
                return(this.RedirectToAction(a => a.Index()));
            }

            var viewModel = SeminarViewModel.Create(Repository, seminar.Site, seminar);

            viewModel.IsCurrent     = SiteService.GetLatestSeminar(Site).Id == seminar.Id;
            viewModel.DisplayPeople = _personService.GetDisplayPeopleForSeminar(seminar.Id, Site);

            return(View(viewModel));
        }
Ejemplo n.º 3
0
        public static SeminarViewModel ReadArchiveSeminar()
        {
            var imported = Db.Trackings.Where(a => a.Name == _ArchiveSeminarTable).Any();

            var seminars = new List <Seminar>();
            var errors   = new List <KeyValuePair <string, string> >();

            ReadData("~/Assets/archived_Seminar.xls", imported, seminars, errors);

            if (!imported)
            {
                var tracking = new Tracking()
                {
                    Name = _ArchiveSeminarTable
                };
                Db.Trackings.Add(tracking);
                Db.SaveChanges();
            }

            var viewModel = SeminarViewModel.Create(seminars, errors, imported);

            return(viewModel);
        }
Ejemplo n.º 4
0
        public ActionResult Edit(int id, Seminar seminar)
        {
            var origSeminar = LoadSeminar(id);

            if (origSeminar == null)
            {
                ErrorMessages = string.Format(Messages.NotFound, "Seminar", id);
                return(this.RedirectToAction(a => a.Index()));
            }

            Mapper.Map(seminar, origSeminar);

            if (ModelState.IsValid)
            {
                _seminarRepository.EnsurePersistent(origSeminar);
                Message = string.Format(Messages.Saved, "Seminar");
                return(this.RedirectToAction(a => a.Index()));
            }

            var viewModel = SeminarViewModel.Create(Repository, seminar.Site, seminar);

            return(View(viewModel));
        }
Ejemplo n.º 5
0
        public ActionResult Create(Seminar seminar)
        {
            seminar.Site = SiteService.LoadSite(Site);
            ModelState.Clear();
            seminar.TransferValidationMessagesTo(ModelState);

            if (ModelState.IsValid)
            {
                _seminarRepository.EnsurePersistent(seminar);

                var mlInvitation = new MailingList(MailingLists.Invitation, seminar)
                {
                    Description = MailingLists.InvitationDescription
                };
                var mlRegistered = new MailingList(MailingLists.Registered, seminar)
                {
                    Description = MailingLists.RegisteredDescription
                };
                var mlAttending = new MailingList(MailingLists.Attending, seminar)
                {
                    Description = MailingLists.AttendingDescription
                };
                var mlPaymentReminder = new MailingList(MailingLists.PaymentReminder, seminar)
                {
                    Description = MailingLists.PaymentReminderDescription
                };
                var mlHotelReminder = new MailingList(MailingLists.HotelReminder, seminar)
                {
                    Description = MailingLists.HotelReminderDescription
                };
                var mlPhotoReminder = new MailingList(MailingLists.PhotoReminder, seminar)
                {
                    Description = MailingLists.PhotoReminderDescription
                };
                var mlBioReminder = new MailingList(MailingLists.BioReminder, seminar)
                {
                    Description = MailingLists.BioReminderDescription
                };
                var mlApplied = new MailingList(MailingLists.Applied, seminar)
                {
                    Description = MailingLists.AppliedDescription
                };
                var mlDenied = new MailingList(MailingLists.Denied, seminar)
                {
                    Description = MailingLists.DeniedDescription
                };

                _mailingListRepository.EnsurePersistent(mlInvitation);
                _mailingListRepository.EnsurePersistent(mlRegistered);
                _mailingListRepository.EnsurePersistent(mlAttending);
                _mailingListRepository.EnsurePersistent(mlPaymentReminder);
                _mailingListRepository.EnsurePersistent(mlHotelReminder);
                _mailingListRepository.EnsurePersistent(mlPhotoReminder);
                _mailingListRepository.EnsurePersistent(mlBioReminder);
                _mailingListRepository.EnsurePersistent(mlApplied);
                _mailingListRepository.EnsurePersistent(mlDenied);

                Message = string.Format(Messages.Saved, "Seminar");
                return(this.RedirectToAction(a => a.Index()));
            }

            var viewModel = SeminarViewModel.Create(Repository, seminar.Site, seminar);

            return(View(viewModel));
        }
Ejemplo n.º 6
0
        public ActionResult Create()
        {
            var viewModel = SeminarViewModel.Create(Repository, SiteService.LoadSite(Site));

            return(View(viewModel));
        }