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"); }
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(); }
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"); }