public List<Attfile_entity> Load_att(string _news_seo) { List<Attfile_entity> l = new List<Attfile_entity>(); var list = (from a in db.ESHOP_EXT_FILEs join b in db.ESHOP_NEWS_ATTs on a.EXT_FILE_ID equals b.EXT_ID where b.ESHOP_NEW.NEWS_SEO_URL==_news_seo select new { EXT_FILE_IMAGE = a.EXT_FILE_IMAGE, NEWS_ATT_FILE = b.NEWS_ATT_FILE, NEWS_ATT_URL = b.NEWS_ATT_URL, NEWS_ATT_NAME = b.NEWS_ATT_NAME, EXT_ID = b.EXT_ID, NEWS_ID = b.NEWS_ID }); foreach (var i in list) { Attfile_entity att = new Attfile_entity(); att.EXT_FILE_IMAGE = i.EXT_FILE_IMAGE; att.NEWS_ATT_FILE = i.NEWS_ATT_FILE; att.NEWS_ATT_URL = i.NEWS_ATT_URL; att.NEWS_ATT_NAME = i.NEWS_ATT_NAME; att.EXT_ID = Utils.CIntDef(i.EXT_ID); att.NEWS_ID = Utils.CIntDef(i.NEWS_ID); l.Add(att); } return l; }
public IQueryable<Attfile_entity> Loadatt_file(int _newsID) { try { List<Attfile_entity> l=new List<Attfile_entity>(); var list = (from a in db.ESHOP_EXT_FILEs join b in db.ESHOP_NEWS_ATTs on a.EXT_FILE_ID equals b.EXT_ID where b.NEWS_ID == _newsID select new { EXT_FILE_IMAGE = a.EXT_FILE_IMAGE, NEWS_ATT_FILE = b.NEWS_ATT_FILE, NEWS_ATT_URL = b.NEWS_ATT_URL, NEWS_ATT_NAME = b.NEWS_ATT_NAME, EXT_ID = b.EXT_ID, NEWS_ID = b.NEWS_ID }); foreach (var i in list) { Attfile_entity att = new Attfile_entity(); att.EXT_FILE_IMAGE = i.EXT_FILE_IMAGE; att.NEWS_ATT_FILE = i.NEWS_ATT_FILE; att.NEWS_ATT_URL = i.NEWS_ATT_URL; att.NEWS_ATT_NAME = i.NEWS_ATT_NAME; att.EXT_ID =Utils.CIntDef(i.EXT_ID); att.NEWS_ID = Utils.CIntDef(i.NEWS_ID); l.Add(att); } return l.AsQueryable(); } catch (Exception) { throw; } }