public static SelectList GetAllActiveUsers(string ConnectionString, int UserId) { List <UsersEntity> lstUsers = new List <UsersEntity>(); SettingFacade fac = new SettingFacade(ConnectionString); lstUsers = fac.GetUsersList(); List <SelectListItem> lstGetAllUser = new List <SelectListItem>(); lstUsers = lstUsers.Where(x => x.UserStatusCode.ToString() == "101001" && x.UserId != UserId).GroupBy(x => x.UserName).Select(g => g.First()).ToList(); foreach (var item in lstUsers) { lstGetAllUser.Add(new SelectListItem { Value = item.UserId.ToString(), Text = item.UserName.ToString() }); } return(new SelectList(lstGetAllUser, "Value", "Text")); }