public ActionResult AssignRegionToBranch(FormCollection collection) { var user = (ViewUser)Session["user"]; Branch branch = new Branch { BranchId = Convert.ToInt32(collection["BranchId"]) }; List <Region> regionList = new List <Region>(); string[] tokens = collection["RegionId"].Split(','); for (int i = 0; i < tokens.Length; i++) { regionList.Add(new Region { RegionId = Convert.ToInt32(tokens[i]) }); } branch.RegionList = regionList; int rowAffected = _iRegionManager.AssignRegionToBranch(branch, user); var branches = _iBranchManager.GetAllBranches(); ViewBag.AssignedRegions = _iBranchManager.GetAssignedRegionToBranchList(); return(View(branches)); }