private static List <OgrenciViewModel> TezAlabilenOgrenciler() { int tezDonemID = new TezDonemService().TezDonemiGetir().Last().ID; int[] DonemdekiTezler = new TezService().TezleriGetir().Where(x => x.TezDonemID == tezDonemID).Select(x => x.ID).ToArray(); int[] DonemdekiOgrenciler = new TezOgrenciService().TezOgrencileriGetir().Where(x => DonemdekiTezler.Contains(x.TezID)).Select(x => x.OgrenciID).ToArray(); List <OgrenciViewModel> lst = new List <OgrenciViewModel>(); List <Kullanici> kullanicilar = new KullaniciService().KullanicilariGetir().ToList(); List <Ogrenci> ogrenciler = new OgrenciService().OgrencileriGetir().ToList().Where(x => !DonemdekiOgrenciler.Contains(x.ID)).ToList(); foreach (var item in ogrenciler) { Kullanici _kul = kullanicilar.Where(x => x.ID == item.ID).SingleOrDefault(); OgrenciViewModel ovm = new OgrenciViewModel { ID = item.ID, OgrenciNo = item.OgrenciNumarasi, Ad = _kul.Ad, Fotograf = _kul.Fotograf, Mail = _kul.Mail, Soyad = _kul.Soyad }; lst.Add(ovm); } return(lst); }
private static List <TezViewModel> TezGetir() { List <TezViewModel> lst = new List <TezViewModel>(); TezService client = new TezService(); List <Kullanici> kullanicilar = new KullaniciService().KullanicilariGetir().ToList(); List <Ogretmen> ogretmenler = new OgretmenService().OgretmenleriGetir().ToList(); foreach (Tez item in client.TezleriGetir()) { TezViewModel tvm = new TezViewModel { ID = item.ID, TezAdi = item.TezAdi, TezDonemID = item.TezDonemID, TezKodID = item.TezKodID, OgretmenID = item.OgretmenID, TezDonemi = new TezDonemService().TezDonemiGetir().Where(x => x.ID == item.TezDonemID).SingleOrDefault().TezDonemAdi, EklenmeTarihi = item.OlusturmaTarihi }; OgretmenViewModel tmp = OgretmenleriGetir().SingleOrDefault(x => x.ID == item.OgretmenID); tvm.OgretimGorevlisi = $"{tmp.Unvan} {tmp.Ad} {tmp.Soyad}"; lst.Add(tvm); } return(lst); }
public ActionResult TezDosyalariPartialView(int ID) { List <Kullanici> kullanicilar = new KullaniciService().KullanicilariGetir().ToList(); TezDosyaYuklemeDuyurusu duyuru = new TezDosyaYuklemeDuyuruService().TezDosyaYuklemeDuyurulariGetir().Where(x => x.ID == ID).SingleOrDefault(); Tez tez = new TezService().TezleriGetir().SingleOrDefault(x => x.ID == ID); if (tez != null) { TezDosyaYuklemeViewModel model = new TezDosyaYuklemeViewModel { Tez = tez, TezDosyaYuklemeDuyurusu = duyuru, TezDosyaYukleme = new TezDosyaYuklemeService().TezDosyaYuklemeGetir().Where(x => x.TezID == tez.ID). Select(y => new TezDosyaYukleme { ID = y.ID, DosyaAciklama = y.DosyaAciklama, DosyaAdi = y.DosyaAdi, DosyaYolu = y.DosyaYolu, TezDosyaYuklemeDuyuruID = y.TezDosyaYuklemeDuyuruID, OlusturmaTarihi = y.OlusturmaTarihi, YukleyenOgrenciBilgisi = $"{kullanicilar.SingleOrDefault(x => x.ID == y.YuklenenOgrenciID).Ad} {kullanicilar.SingleOrDefault(x => x.ID == y.YuklenenOgrenciID).Soyad}", TezID = y.TezID, YuklenenOgrenciID = y.YuklenenOgrenciID }).ToList() }; return(View(model)); } return(View()); }
public List <TezDosyaYuklemeViewModel> TezDosyaYuklemeListesi() { //Tez Adı - Ogretim Görevlisi - Tez Ders Kodu - Tez Donemi - Dosya Adı - Açıklaması - Yukleyen Ogrenci List <Kullanici> _kullanicilar = new KullaniciService().KullanicilariGetir().ToList(); List <TezDosyaYuklemeViewModel> lst = new List <TezDosyaYuklemeViewModel>(); foreach (TezDosyaYukleme tezdosya in new TezDosyaYuklemeService().TezDosyaYuklemeGetir().ToList()) { Tez _tez = new TezService().TezleriGetir().FirstOrDefault(x => x.ID == tezdosya.TezID); TezDersKod _tezDersKod = new TezDersKodService().TezDersKodlariGetir().FirstOrDefault(x => x.ID == _tez.TezKodID); TezDonemi _tezDonemi = new TezDonemService().TezDonemiGetir().FirstOrDefault(x => x.ID == _tez.TezDonemID); Ogretmen _ogretmen = new OgretmenService().OgretmenleriGetir().FirstOrDefault(x => x.ID == _tez.OgretmenID); TezDosyaYuklemeViewModel model = new TezDosyaYuklemeViewModel { ID = tezdosya.ID, DosyaAciklama = tezdosya.DosyaAciklama, DosyaAdi = tezdosya.DosyaAdi, DosyaYolu = tezdosya.DosyaYolu, Ogrenci = _kullanicilar.Where(x => x.ID == tezdosya.YuklenenOgrenciID).ToList(), Ogretmen = _kullanicilar.FirstOrDefault(x => x.ID == _tez.OgretmenID), Tez = _tez, TezDersKodu = _tezDersKod, TezDonemi = _tezDonemi, Unvan = _ogretmen.Unvan, EklenmeTarihi = tezdosya.OlusturmaTarihi }; lst.Add(model); } return(lst); }
private List <TezViewModel> OgretimGorevlisininTezleri(int?ogretimGorevlisiID = null) { if (ogretimGorevlisiID != null) { OgretimGorevlisiID = (int)ogretimGorevlisiID; } List <TezViewModel> lst = new List <TezViewModel>(); TezService client = new TezService(); List <Kullanici> kullanicilar = new KullaniciService().KullanicilariGetir().ToList(); foreach (Tez item in client.TezleriGetir().Where(x => x.OgretmenID == OgretimGorevlisiID)) { TezViewModel tvm = new TezViewModel { ID = item.ID, TezAdi = item.TezAdi, TezDonemID = item.TezDonemID, TezKodID = item.TezKodID, TezDonemi = new TezDonemService().TezDonemiGetir().Where(x => x.ID == item.TezDonemID).SingleOrDefault().TezDonemAdi }; lst.Add(tvm); } return(lst); }
private bool KullaniciKontrol(string mail, int ID = 0) { KullaniciService client = new KullaniciService(); if (ID == 0) { return(client.KullanicilariGetir().ToList().Where(x => x.Mail == mail).FirstOrDefault() != null ? false : true); } return(client.KullanicilariGetir().ToList().Where(x => x.Mail == mail && x.ID != ID).FirstOrDefault() != null ? false : true); }
private int KullaniciEkle(KullaniciBaseModel model) { KullaniciService client = new KullaniciService(); Kullanici kul = new Kullanici { Ad = model.Ad, Fotograf = model.Fotograf, Mail = model.Mail, RolID = model.RolID, Soyad = model.Soyad, Sifre = model.Sifre }; return(client.KullaniciEkle(kul).ID); }
private void KullaniciGuncelle(KullaniciBaseModel model) { KullaniciService client = new KullaniciService(); Kullanici _kul = client.KullanicilariGetir().Where(x => x.ID == model.ID).SingleOrDefault(); if (_kul != null) { _kul.Ad = model.Ad; _kul.Mail = model.Mail; _kul.Soyad = model.Soyad; _kul.Sifre = model.Sifre; } if (model.Fotograf != null) { _kul.Fotograf = model.Fotograf; } client.KullaniciGuncelle(_kul); }
private static List <OgretmenViewModel> OgretmenleriGetir() { List <OgretmenViewModel> lst = new List <OgretmenViewModel>(); List <Kullanici> kullanicilar = new KullaniciService().KullanicilariGetir().ToList(); List <Ogretmen> ogretmenler = new OgretmenService().OgretmenleriGetir().ToList(); foreach (var item in ogretmenler) { Kullanici _kul = kullanicilar.Where(x => x.ID == item.ID).SingleOrDefault(); OgretmenViewModel ovm = new OgretmenViewModel { ID = item.ID, Unvan = item.Unvan, Ad = _kul.Ad, Fotograf = _kul.Fotograf, Mail = _kul.Mail, Soyad = _kul.Soyad }; lst.Add(ovm); } return(lst); }
/// <summary> /// giriş yapmış tüm rollere açık methot /// </summary> /// <param name="ID"></param> /// <returns></returns> //[AdminRole] public ActionResult Detay(int?ID) { if (ID != null) { Ogrenci ogr = new OgrenciService().OgrencileriGetir().SingleOrDefault(x => x.ID == ID); Kullanici kul = new KullaniciService().KullanicilariGetir().SingleOrDefault(x => x.ID == ID); if (kul != null && ogr != null) { OgrenciViewModel model = new OgrenciViewModel { ID = ogr.ID, Ad = kul.Ad, Fotograf = kul.Fotograf, Mail = kul.Mail, OgrenciNo = ogr.OgrenciNumarasi, Soyad = kul.Soyad }; return(View(model)); } } ViewBag.Mesaj = "Kullanıcı bulunamadı..."; return(null); }
public ActionResult Detay(int?ID) { if (ID != null) { Ogretmen ogr = new OgretmenService().OgretmenleriGetir().SingleOrDefault(x => x.ID == ID); Kullanici kul = new KullaniciService().KullanicilariGetir().SingleOrDefault(x => x.ID == ID); if (kul != null && ogr != null) { OgretmenViewModel model = new OgretmenViewModel { ID = ogr.ID, Ad = kul.Ad, Fotograf = kul.Fotograf, Mail = kul.Mail, Unvan = ogr.Unvan, Soyad = kul.Soyad }; ViewBag.OgretimGorevlisininTezleri = OgretimGorevlisininTezleri(ID); return(View(model)); } } ViewBag.Mesaj = "Kullanıcı bulunamadı..."; return(null); }
public KullaniciServiceTest() { _kullaniciService = new KullaniciService(new GenericRepository()); }