public ActionResult CreateEvent(Event e)
        {
            HockeySignupsDb db = new HockeySignupsDb(_connectionString);

            db.AddEvent(e);
            #region TempData
            TempData["Message"] = "Event Successfully created, Id: " + e.Id;
            #endregion
            IEnumerable <NotificationSignup> signups = db.GetNotificationSignups();
            foreach (NotificationSignup signup in signups)
            {
                //send email using signup.Email
            }
            return(RedirectToAction("Index", "Hockey"));
        }
Beispiel #2
0
        public ActionResult CreateEvent(DateTime date, int maxPeople)
        {
            var   db = new HockeySignupsDb(_connectionString);
            Event e  = new Event {
                Date = date, MaxPeople = maxPeople
            };

            db.AddEvent(e);
            TempData["Message"] = "Event Successfully created, Id: " + e.Id;
            IEnumerable <NotificationSignup> signups = db.GetNotificationSignups();

            foreach (NotificationSignup signup in signups)
            {
                //send email using signup.Email
            }
            return(RedirectToAction("Index", "Hockey"));
        }
        public ActionResult CreateEvent(DateTime date, int maxPeople)
        {
            var   db = new HockeySignupsDb(Properties.Settings.Default.ConStr);
            Event e  = new Event {
                Date = date, MaxPeople = maxPeople
            };

            db.AddEvent(e);

            TempData["Message"] = "Event Successfully created, Id: " + e.Id;
            IEnumerable <NotificationSignup> signups = db.GetNotificationSignups();

            foreach (NotificationSignup signup in signups)
            {
                SendNotificationEmail(signup);
            }
            return(RedirectToAction("Index", "Hockey"));
        }