Exemplo n.º 1
0
        public ActionResult AddToTeam(int id)
        {
            var currentUser = GetCurrentUser();

            using (var usersDB = new ApplicationDbContext())
            {
                currentUser.InTeam = id;
                UpdateModel(currentUser, new string[] { "InTeam" });

                usersDB.EditApplicationUser(currentUser, usersDB);
            }

            return RedirectToAction("MyTeam");
        }
Exemplo n.º 2
0
        public ActionResult Edit(ApplicationUser user)
        {
            var currentUser = GetCurrentUser();
            currentUser.SexMale = user.SexMale;

            using (var usersDB = new ApplicationDbContext())
            {
                UpdateModel(currentUser, new string[] { "SexMale" });

                usersDB.EditApplicationUser(currentUser, usersDB);
            }

            currentUser = GetCurrentUser();


            //return View("MyProfile", currentUser); // melo by byt tohle ale chyba dispose database
            return View();
        }
Exemplo n.º 3
0
        public ActionResult Confirmation(string name)
        {
            string leaderId = User.Identity.GetUserId();
            if (ValidChange(name, leaderId))
            {
                ApplicationUser user;
                using (var usersDB = new ApplicationDbContext())
                {
                    user = usersDB.Users.Where(u => u.UserName == name).SingleOrDefault();
                    user.TeamConfirmed = true;
                    UpdateModel(user, new string[] { "TeamConfirmed" });

                    usersDB.EditApplicationUser(user, usersDB);
                }
            }          

            return RedirectToAction("MyTeam");
        }