public ActionResult ManageFeature(string[] SystemFeatureID) { bool bUpdate = false; Guid UserGroupID = new Guid(CurrentUserGroupID); if (SystemFeatureID != null) { GroupFeature groupFeatureUpdate = new GroupFeature(); groupFeatureUpdate.DeleteGroupFeatureByGroup(UserGroupID); foreach (string sSystemFeatureID in SystemFeatureID) { Guid gSystemFeatureID = new Guid(sSystemFeatureID); bUpdate = groupFeatureUpdate.InsertGroupFeature(UserGroupID, gSystemFeatureID); } if (bUpdate) { return(RedirectToAction("UserGroup")); } } ViewBag.UserGroupID = UserGroupID; List <GroupFeaturesDisplay> groupFeatureDisplayList = new List <GroupFeaturesDisplay>(); List <GroupFeature> groupFeatureList = db.GroupFeatures.Where(i => i.UserGroupID == UserGroupID).ToList <GroupFeature>(); List <SystemFeature> systemFeatureList = db.SystemFeatures.ToList <SystemFeature>(); foreach (SystemFeature systemFeature in systemFeatureList) { GroupFeaturesDisplay groupFeatureDisplay = new GroupFeaturesDisplay(); groupFeatureDisplay.UserGroupID = UserGroupID; groupFeatureDisplay.SystemFeatureID = systemFeature.SystemFeatureID; groupFeatureDisplay.FeatureName = systemFeature.FeatureName; groupFeatureDisplay.ControllerName = systemFeature.ControllerName; groupFeatureDisplay.ActionName = systemFeature.ActionName; foreach (GroupFeature groupFeature in groupFeatureList) { if (systemFeature.SystemFeatureID == groupFeature.SystemFeatureID) { groupFeatureDisplay.Selected = true; break; } else { groupFeatureDisplay.Selected = false; } } groupFeatureDisplayList.Add(groupFeatureDisplay); } return(View(groupFeatureDisplayList)); }