public IList <YorumDto> GetList(int yaziId) { List <YorumDto> yorumList = new List <YorumDto>(); var yorumRep = new EfRepositoryBase <Yorum, YilmazCoderContext>(); var kulRep = new EfRepositoryBase <Kullanici, YilmazCoderContext>(); var yorumLst = (from yorum in yorumRep.GetList(x => x.YaziId == yaziId) join kul in kulRep.GetList() on yorum.KullaniciId equals kul.Id select new { yorum = yorum, kullanici = kul }).ToList(); foreach (var item in yorumLst) { YorumDto y = new YorumDto(); y.Id = item.yorum.Id; y.Aciklama = item.yorum.Aciklama; y.KayitTarihi = item.yorum.KayitTarihi; y.KullaniciAdi = item.kullanici.KullaniciAdi; y.KullaniciId = item.kullanici.Id; y.YaziId = item.yorum.YaziId; y.KullaniciResmi = item.kullanici.Resim; yorumList.Add(y); } return(yorumList); }
public List <Yetki> YetkiList(Kullanici kullanici) { List <Yetki> ylist = new List <Yetki>(); var yetkiRep = new EfRepositoryBase <Yetki, YilmazCoderContext>(); var kullaniciYetkiRep = new EfRepositoryBase <KullaniciYetki, YilmazCoderContext>(); var yazilist = yetkiRep.GetList().Join(kullaniciYetkiRep.GetList(x => x.KullaniciId == kullanici.Id), yetki => yetki.Id, kullaniciYetki => kullaniciYetki.KullaniciId, (yetki, kullaniciYetki) => new { Yetki = yetki, KullaniciYetki = kullaniciYetki }).ToList(); foreach (var item in yazilist) { Yetki y = new Yetki(); y.Id = item.Yetki.Id; y.Adi = item.Yetki.Adi; ylist.Add(y); } return(ylist); }