public ActionResult Save(FormCollection FormCollection, UserAuthenticationModel UserAuthenticationModel) { string result = string.Empty; LocationBL.UserAuthentication = "UserAuthentication"; LocationBL.EmailID = User.Identity.Name; UserAuthenticationModel.lstLocations = LocationBL.GetAll(); string ULLocationIDs = string.Empty; string MLLocationIDs = string.Empty;; for (int i = 0; i < UserAuthenticationModel.lstLocations.Count; i++) { string ULLocId = UserAuthenticationModel.lstLocations[i].LocationID + "UL" + i; string MLLocId = UserAuthenticationModel.lstLocations[i].LocationID + "ML" + i; var ULColl = FormCollection[ULLocId].Split(','); var MLColl = FormCollection[MLLocId].Split(','); if (ULColl.Length > 0) { bool ULChecked = ULColl[0].Contains("true"); if (ULChecked) { ULLocationIDs = (UserAuthenticationModel.lstLocations[i].LocationID.Trim()) + "," + ULLocationIDs; } } if (MLColl.Length > 0) { bool MLChecked = MLColl[0].Contains("true"); if (MLChecked) { MLLocationIDs = (UserAuthenticationModel.lstLocations[i].LocationID.Trim()) + "," + MLLocationIDs; } } } AuthenticationBL.SaveAuthentication(UserAuthenticationModel, ULLocationIDs, MLLocationIDs); LocationBL.UserAuthentication = string.Empty; UserAuthenticationModel.lstUseridsbyManager = AuthenticationBL.SelectUserId(User.Identity.Name); UserAuthenticationModel.lstAspNetRole = AuthenticationBL.AspNetRoleGetAll(); result = "Success"; return(View("Index", UserAuthenticationModel)); }