Beispiel #1
0
        public ActionResult Join(JoinClub model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var _userId = Guid.Parse(User.Identity.GetUserId());
            var service = CreateClubService(_userId);

            if (service.CreateNewClubMember(model.ClubId, model.StudentId))
            {
                TempData["SaveResult"] = "You have joined " + model.ClubTitle;
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Sorry, you could not join the club");

            return(View());
        }
Beispiel #2
0
        // Get : Join
        public ActionResult Join(int id)
        {
            //var service = CreateClubService(_userId);
            // Change the Db table to include student id? JoinClub already has this, as does student.
            // How to relate student id to the user? Take this in from the register panel?
            //service.CreateNewClubMember(id);
            //return RedirectToAction("Index");
            // Get the club name from the id
            var        _userId    = Guid.Parse(User.Identity.GetUserId());
            var        service    = CreateClubService(_userId);
            ClubDetail club       = service.GetClubById(id);
            JoinClub   clubToJoin =
                new JoinClub
            {
                StudentId = 0,
                ClubTitle = club.Title,
                ClubId    = club.ClubId
            };

            return(View(clubToJoin));
        }