public ActionResult AddSignUp(string firstName, string lastname, string email, int eventid) { HockeyDb db = new HockeyDb(conn); Event e = new Event(); e = db.GetLatestEvent(); ViewModel vm = new ViewModel(); vm.Event = e; vm.Status = db.GetEventStatus(e); if (vm.Status == EventStatus.Open) // if (db.GetNumberofSignUps(eventid) < db.GetMaxPlayersForEvent(eventid) && e.Dt > DateTime.Now) { SignUp s = new SignUp(); s.FirstName = firstName; s.LastName = lastname; s.Email = email; s.EventId = eventid; db.CreateSignUps(s); TempData["Message"] = "You're successfully signed up!!"; } else { TempData["Message"] = "YOU are NOT signed up!"; } return(RedirectToAction("index")); }
public ActionResult AddSignUp() { HockeyDb db = new HockeyDb(conn); Event e = new Event(); e = db.GetLatestEvent(); ViewModel vm = new ViewModel(); vm.Event = e; vm.Status = db.GetEventStatus(e); return(View(vm)); }