Exemple #1
0
        public List <GetListNguoiDung_Result> List(string search)
        {
            using (var db = new QLPhongKaraokeEntities())
            {
                IEnumerable <GetListNguoiDung_Result> query = db.GetListNguoiDung();

                //Filter // neu de search=null thi kho search,
                if (!string.IsNullOrEmpty(search))
                {
                    query = query.Where(x => (x.MaDangNhap != null &&
                                              x.MaDangNhap.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) ||
                                        (x.HoTen != null &&
                                         x.HoTen.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) ||
                                        (x.Email != null &&
                                         x.Email.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) ||
                                        (x.SoDT != null &&
                                         x.SoDT.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0)

                                        );
                }

                return(query.ToList());
            }
        }