Esempio n. 1
0
        public ActionResult EventSignup(string firstName, string lastName, string email, int eventId)
        {
            var db = new HockeySignupsDb(_connectionString);
            var e = db.GetEventById(eventId);
            var status = db.GetEventStatus(e);
            if (status == EventStatus.InThePast)
            {
                TempData["Error"] = "You cannot sign up to a game in the past. Jerk.";
                return RedirectToAction("Index");
            }
            else if (status == EventStatus.Full)
            {
                TempData["Error"] = "Nice try sucker....";
                return RedirectToAction("Index");
            }
            EventSignup s = new EventSignup
            {
                Email = email,
                FirstName = firstName,
                LastName = lastName,
                EventId = eventId
            };
            db.AddEventSignup(s);

            TempData["Message"] =
                "You have succesfully signed up for this weeks game, looking forward to checking you into the boards!";
            return RedirectToAction("Index");
        }
Esempio n. 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;
     return RedirectToAction("Index", "Hockey");
 }
Esempio n. 3
0
 public ActionResult LatestEvent()
 {
     var db = new HockeySignupsDb(_connectionString);
     Event latestEvent = db.GetLatestEvent();
     EventSignupViewModel vm = new EventSignupViewModel();
     vm.Event = latestEvent;
     vm.EventStatus = db.GetEventStatus(latestEvent);
     return View(vm);
 }
Esempio n. 4
0
 public ActionResult EventDetails(int id)
 {
     var db = new HockeySignupsDb(_connectionString);
     Event e = db.GetEventById(id);
     IEnumerable<EventSignup> signups = db.GetEventSignups(id);
     var vm = new EventDetailsViewModel
     {
         Event = e,
         Signups = signups
     };
     return View(vm);
 }
Esempio n. 5
0
 static void Main(string[] args)
 {
     HockeySignupsDb db = new HockeySignupsDb(Settings1.Default.ConStr);
     //var e = new Event {Date = DateTime.Today.AddDays(3), MaxPeople = 20};
     //db.AddEvent(e);
     //Console.WriteLine(e.Id);
     db.GetEvents().ToList().ForEach(e =>
     {
         Console.WriteLine(e.Date + " " + e.MaxPeople + " " + e.Id);
     });
     Console.ReadKey(true);
 }
Esempio n. 6
0
 public ActionResult NotificationSignup(string firstName, string lastName, string email)
 {
     var db = new HockeySignupsDb(_connectionString);
     var ns = new NotificationSignup
     {
         Email = email,
         FirstName = firstName,
         LastName = lastName
     };
     db.AddNotificationSignup(ns);
     return View("NotificationSignupConfirmation");
 }
Esempio n. 7
0
 public ActionResult History()
 {
     var db = new HockeySignupsDb(_connectionString);
     IEnumerable<EventWithPeople> events = db.GetEventsWithCount();
     return View(events);
 }