public void AddRegistration(Registration registration)
 {
     using (var registrationsContext = new RegistrationContext())
     {
         registrationsContext.Entry(registration).State = System.Data.Entity.EntityState.Added;
         registrationsContext.SaveChanges();
     }
 }
        public ActionResult DetailsPost(int SelectList, int tournamentId)
        {
            var currentUser = User.Identity.GetUserId();

            var registrationsContext = new RegistrationContext();

            var registration = new Registration();
            registration.Paid = false;
            registration.GroupId = SelectList;
            registration.UserId = currentUser;
            registration.TournamentId = tournamentId;

            if (ModelState.IsValid)
            {
                registrationsContext.AddRegistration(registration);
                UpdateModel(registrationsContext);
            }

            var tournament = ForDetails(currentUser, tournamentId);

            return View(tournament);
        }