public ActionResult AddUser(int id) { var newModel = new UserCommunityViewModel(); newModel.Member.TeamId = id; int userId = UserRepository.GetUserId(); newModel.UserCommunity = TeamRepository.GetUserCommunity(userId); return(View(newModel)); }
public ActionResult AddUser(UserCommunityViewModel newModel) { if (UserRepository.IsUserSigned()) { if (newModel.Member.Mail != null) { var existUser = db.Users.FirstOrDefault(x => x.Mail == newModel.Member.Mail); TeamRepository.AddUserToTeam(existUser.UserId, newModel.Member.TeamId, 3); } return(RedirectToAction("Edit", "Team", new { id = newModel.Member.TeamId })); } return(RedirectToAction("Login", "User")); }