public ActionResult AddMember(int id)
        {
            List <ApplicationUser> posibleNewMembers = GetPossibleNewMembers();
            MemberToTeam           fmm = new MemberToTeam
            {
                TeamId = id
            };
            var viewModel = new AddMemberToTeamViewModel
            {
                MemberToTeam       = fmm,
                PossibleNewMembers = posibleNewMembers
            };

            return(View("AddMember", viewModel));
        }
        public ActionResult SaveNewMember(MemberToTeam memberToTeam)
        {
            var viewModel = new AddMemberToTeamViewModel
            {
                MemberToTeam = memberToTeam
            };

            if (!ModelState.IsValid)
            {
                return(View("AddMember", viewModel));
            }

            _context.MemberToTeams.Add(memberToTeam);
            _context.SaveChanges();
            TempData["message"] = "Membrul a fost adaugat";
            return(RedirectToAction("ShowTeam", new { id = memberToTeam.TeamId }));
        }
        public ActionResult SaveMemberToTeam(MemberToTeam memberToTeam)
        {
            List <ApplicationUser> posibleNewMembers = GetPossibleNewMembers();
            var viewModel1 = new AddMemberToTeamViewModel
            {
                MemberToTeam       = memberToTeam,
                PossibleNewMembers = posibleNewMembers
            };

            if (!ModelState.IsValid)
            {
                return(View("AddMember", viewModel1));
            }

            _context.MemberToTeams.Add(memberToTeam);
            _context.SaveChanges();

            return(RedirectToAction("Show", memberToTeam.TeamId));
        }