public List <UserModels.UserModel> GetUserList() { var user_model = (from U in Entities.S_User join B in Entities.S_Branch on U.BranchID equals B.BranchID into LBranch from leftBranch in LBranch.DefaultIfEmpty() join L in Entities.S_Location on U.LocationID equals L.LocationID into LUser from leftUser in LUser.DefaultIfEmpty() select new UserModels.UserModel { UserID = U.UserID, UserName = U.UserName, UserPassword = U.UserPassword, BranchName = leftBranch.BranchName, LocationName = leftUser.LocationName }).ToList(); return(user_model.ToList()); }
public List <UserModels.UserModel> SearchUserData(string search) { var user = (from U in Entities.S_User join B in Entities.S_Branch on U.BranchID equals B.BranchID into LBranch from leftBranch in LBranch.DefaultIfEmpty() join L in Entities.S_Location on U.LocationID equals L.LocationID into LUser from leftUser in LUser.DefaultIfEmpty() where U.UserName.Contains(search) select new UserModels.UserModel { UserID = U.UserID, UserName = U.UserName, UserPassword = U.UserPassword, BranchName = leftBranch.BranchName, LocationName = leftUser.LocationName }).ToList(); return(user.ToList()); }