示例#1
0
        public static void SetupConferenceDates(OpenCloseDate model)
        {
            using (var site = new SCBWIContext()) {
                var open = new Date {
                    Category = Category.Open,
                    Name     = "Conference Open",
                    Value    = model.OpenDate
                };

                var close = new Date {
                    Category = Category.Close,
                    Name     = "Conference Close",
                    Value    = model.CloseDate
                };

                var regopen = new Date {
                    Category = Category.RegistrationOpen,
                    Name     = "Registration Open",
                    Value    = model.RegOpenDate
                };

                var regclose = new Date {
                    Category = Category.RegistrationClose,
                    Name     = "Registration Close",
                    Value    = model.RegCloseDate
                };

                var late = new Date {
                    Category = Category.Late,
                    Name     = "Late Registration Date",
                    Value    = model.RegLateDate
                };

                var edit = new Date {
                    Category = Category.LastEdit,
                    Name     = "Last Edit Date",
                    Value    = model.LastEditDate
                };

                site.Dates.Add(open);
                site.Dates.Add(close);
                site.Dates.Add(regclose);
                site.Dates.Add(regopen);
                site.Dates.Add(late);
                site.Dates.Add(edit);

                site.Information.Add(new Information {
                    Category = Category.Ready,
                    Title    = "Conference Setup Begun",
                    Value    = "in progress"
                });

                site.SaveChanges();
            }
        }
示例#2
0
        public ActionResult ConferenceSetup(OpenCloseDate model)
        {
            if (ModelState.IsValid)
            {
                DAL.SetupConferenceDates(model);

                return(RedirectToAction("RegistrationTypes"));
            }

            ModelState.AddModelError("", "Check your dates, one isn't parsing properly.");
            return(View(model));
        }