public static object GetAll(filter filter)
 {
     using (DB db = new DB())
     {
         var data = db.MKV7001.AsEnumerable().OrderByDescending(a => a.date).Select(p => new
         {
             p.ghiChu, p.date,
             p.MKV7000_ID,
             p.MKV7001_ID,
             p.MKV9999_ID,
             p.MKV9999_ID2,
             p.noiDung,
             p.tieuDe,
             count = db.MKV7001.Where(j => j.MKV9999_ID2 == filter.MKV9999_ID && j.MKV9999_ID == p.MKV9999_ID && j.trangthai == false).Count(),
             p.trangthai,
             MKV9999 = AccountGett.GetAccount(new AccountGett.filter()
             {
                 id = p.MKV9999_ID
             }),
             MKV99992 = AccountGett.GetAccount(new AccountGett.filter()
             {
                 id = p.MKV9999_ID2
             }),
         });
         if (filter.MKV7001_ID != null)
         {
             return(data.Where(p => p.MKV7001_ID == filter.MKV7001_ID).FirstOrDefault());
         }
         if (filter.MKV9999_ID != null)
         {
             data = data.Where(p => p.MKV9999_ID == filter.MKV9999_ID || p.MKV9999_ID2 == filter.MKV9999_ID);
         }
         if (filter.trangthai != null)
         {
             data = data.Where(p => p.trangthai == filter.trangthai);
         }
         if (filter.mybox != null)
         {
             data = data.GroupBy(f => new { f.MKV9999_ID, f.MKV9999_ID2 }).Select(x => x.FirstOrDefault());
         }
         if (filter.point != null)
         {
             data = data.Where(p => p.MKV9999_ID == filter.MKV9999_ID && p.MKV9999_ID2 == filter.MKV9999_ID2 || p.MKV9999_ID == filter.MKV9999_ID2 && p.MKV9999_ID2 == filter.MKV9999_ID);
             data = data.Where(a => a.date < filter.point).Take((int)filter.length);
         }
         return(data.ToList());
     }
 }
        public HttpResponseMessage getnguoiphongvan(string id)
        {
            using (DB db = new DB())
            {
                var data = db.A0028E.AsEnumerable().Where(p => p.A0028_ID == id).Select(p => new
                {
                    p.A0028E_ID,
                    p.A0028_ID, p.MKV9999_ID,
                    MKV9999 = AccountGett.GetAccount(new AccountGett.filter()
                    {
                        id = p.MKV9999_ID
                    })
                });

                return(REST.GetHttpResponseMessFromObject(data));
            }
        }