Example #1
0
        public ActionResult Signup(string firstName, string lastName, string email, int eventId)
        {
            var db = new HockeySignupDb(_connectionString);
            Event e = db.GetEventById(eventId);
            var status = db.GetEventStatus(e);
            if (status != EventStatus.Open)
            {
                return RedirectToAction("Index");
            }

            EventSignup es = new EventSignup
            {
                FirstName = firstName,
                LastName = lastName,
                Email = email,
                EventId = eventId
            };
            db.AddEventSignup(es);

            HttpCookie firstNameCookie = new HttpCookie("firstName", firstName); 
            HttpCookie lastNameCookie = new HttpCookie("lastName", lastName); 
            HttpCookie emailCookie = new HttpCookie("email", email); 

            Response.Cookies.Add(firstNameCookie);
            Response.Cookies.Add(lastNameCookie);
            Response.Cookies.Add(emailCookie);

            TempData["Message"] = "Signup successfully recorded. Can't wait to check you into the boards!!";
            return RedirectToAction("Index");
        }
Example #2
0
        public ActionResult History()
        {
            var db = new HockeySignupDb(_connectionString);
            IEnumerable<EventWithCount> events = db.GetEventsWithCounts();

            return View(events);
        }
Example #3
0
 static void Main(string[] args)
 {
     var db = new HockeySignupDb(Settings1.Default.ConStr);
     Event e = new Event {Date = DateTime.Today.AddDays(3), MaxPeople = 20};
     db.AddEvent(e);
     Console.WriteLine(e.Id);
     Console.ReadKey(true);
 }
Example #4
0
 public ActionResult EventHistory(int id)
 {
     var db = new HockeySignupDb(_connectionString);
     var e = db.GetEventById(id);
     IEnumerable<EventSignup> signups = db.GetEventSignups(id);
     var vm = new HistoryViewModel { Signups = signups, Event = e };
     return View(vm);
 }
Example #5
0
 public ActionResult NotificationSignup(string firstName, string lastName, string email)
 {
     var db = new HockeySignupDb(_connectionString);
     NotificationSignup signup = new NotificationSignup
     {
         FirstName = firstName,
         LastName = lastName,
         Email = email
     };
     db.AddNotificationSignup(signup);
     return View("NotificationConfirmation");
 }
Example #6
0
 public ActionResult CreateEvent(DateTime date, int maxPeople, bool sendEmail)
 {
     var db = new HockeySignupDb(_connectionString);
     Event e = new Event
     {
         Date = date,
         MaxPeople = maxPeople
     };
     db.AddEvent(e);
     
     TempData["Message"] = "Event created successfuly, Id: " + e.Id;
     return RedirectToAction("Index", "Hockey");
 }
Example #7
0
 public ActionResult Latest()
 {
     SignupViewModel vm = new SignupViewModel();
     var db = new HockeySignupDb(_connectionString);
     Event e = db.GetLatestEvent();
     EventStatus status = db.GetEventStatus(e);
     vm.Event = e;
     vm.Status = status;
     vm.Signup = new EventSignup();
     if (Request.Cookies["firstName"] != null)
     {
         vm.Signup.FirstName = Request.Cookies["firstName"].Value;
         vm.Signup.LastName = Request.Cookies["lastName"].Value;
         vm.Signup.Email = Request.Cookies["email"].Value;
     }
     return View(vm);
 }