public ActionResult SubmitChoosenUser()
        {
            //add the choosen users to DB
            if (!Authorize())
            {
                return(RedirectToAction("RedirectByUser", "Home"));
            }
            VMUsersGroup vmUsrGrp = (VMUsersGroup)TempData["VMUsersGroup"];

            if (Request.Form["users[]"] == null)
            {
                ViewBag.erorAddUser = "******";
                return(View("ChooseUser", vmUsrGrp));
            }
            string           usrs      = Request.Form["users[]"].ToString();
            List <string>    userNames = usrs.Split(',').ToList <string>();
            GroupRoommateDal grpRmtDal = new GroupRoommateDal();

            foreach (string usrName in userNames)
            {
                GroupRoommate newRec = new GroupRoommate()
                {
                    groupID  = vmUsrGrp.group.gid,
                    userName = usrName
                };
                grpRmtDal.GroupsRoommates.Add(newRec);
            }
            grpRmtDal.SaveChanges();
            ViewBag.addUsersToGroupSuccess = "המשתמשים התווספו בהצלחה!";
            return(View("ShowManagerPage"));
        }
        public ActionResult AddGroupSubmit([ModelBinder(typeof(GroupBinder))] Group grp)
        {
            //add the new group to DB

            if (!Authorize())
            {
                return(RedirectToAction("RedirectByUser", "Home"));
            }
            VMGroups groupsVM = new VMGroups();
            GroupDal grpDal   = new GroupDal();

            ModelState.Clear();
            TryValidateModel(grp);
            if (ModelState.IsValid)
            {
                grp.managerUserName = ((User)(Session["CurrentUser"])).UserName;
                grpDal.Groups.Add(grp);
                try
                {
                    grpDal.SaveChanges();
                    //reset a new group object to view
                    groupsVM.Group = new Group();
                    GroupRoommate grpRmt = new GroupRoommate()
                    {
                        groupID  = grp.gid,
                        userName = grp.managerUserName
                    };
                    GroupRoommateDal grpRmtDal = new GroupRoommateDal();
                    grpRmtDal.GroupsRoommates.Add(grpRmt);
                    grpRmtDal.SaveChanges();
                    ViewBag.addGroupSuccess = "הקבוצה התווספה בהצלחה!";
                }
                catch (DbUpdateException)
                {
                    ViewBag.addNewGroupError = "התרחשה שגיאה בהוספת הקבוצה";
                    groupsVM.Group           = grp;
                }
            }
            else
            {
                groupsVM.Group = grp;
            }
            groupsVM.Groups = grpDal.Groups.ToList <Group>();
            return(View("AddGroup", groupsVM));
        }