public AnaEkranViewModel(INavigation navigation, ISorularRepository sorularRepository, IDoktorRepository doktorRepository, IHastaneRepository hastaneRepository, IHemsireRepository hemsireRepository, IOdaRepository odalarRepository, IKoridorRepository koridorRepository , INesneRepository nesneRepository, IKullaniciRepository kullaniciRepository) { _doktorRepository = doktorRepository; _hastaneRepository = hastaneRepository; _odalarRepository = odalarRepository; _nesneRepository = nesneRepository; _soruRepository = sorularRepository; _kullaniciRepository = kullaniciRepository; Navigation = navigation; Sorularim = _soruRepository.GetSorularAsync().GetAwaiter().GetResult(); var hastanes = _hastaneRepository.GetHastaneAsync().GetAwaiter().GetResult(); HastaneCommand = new Command(x => { HastaneKayit hastaneKayit = new HastaneKayit(); Navigation.PushModalAsync(hastaneKayit).GetAwaiter(); hastaneKayit.BindingContext = new HastaneKayitViewModel(hastaneRepository); }); NesneKayitCommand = new Command(x => { NesneKayit nesneKayit = new NesneKayit(); Navigation.PushModalAsync(nesneKayit).GetAwaiter(); nesneKayit.BindingContext = new NesneKayitViewModel(odalarRepository, koridorRepository, nesneRepository); }); DoktorKayitCommand = new Command(x => { DoktorKayit doktorKayit = new DoktorKayit(); Navigation.PushModalAsync(doktorKayit).GetAwaiter(); doktorKayit.BindingContext = new DoktorKayitViewModel(doktorRepository, hastaneRepository); }); OdaKayitCommand = new Command(x => { OdaKayit odaKayit = new OdaKayit(); Navigation.PushModalAsync(odaKayit).GetAwaiter(); odaKayit.BindingContext = new OdaKayitViewModel(odalarRepository, koridorRepository); }); KoridorKayitCommand = new Command(x => { KoridorKayit koridorKayit = new KoridorKayit(); Navigation.PushModalAsync(koridorKayit).GetAwaiter(); koridorKayit.BindingContext = new KoridorKayitViewModel(hastaneRepository, koridorRepository); }); HemsireCommand = new Command(x => { HemsireKayit hemsireKayit = new HemsireKayit(); Navigation.PushModalAsync(hemsireKayit).GetAwaiter(); hemsireKayit.BindingContext = new HemsireKayitViewModel(hemsireRepository, hastaneRepository); }); SoruKayitCommand = new Command(x => { SorularSayfasi sorularKayit = new SorularSayfasi(); Navigation.PushModalAsync(sorularKayit).GetAwaiter(); sorularKayit.BindingContext = new SorularViewModel(sorularRepository, odalarRepository, koridorRepository, nesneRepository); }); KullaniciKayitCommand = new Command(x => { KullaniciKayit kullaniciKayit = new KullaniciKayit(); Navigation.PushModalAsync(kullaniciKayit).GetAwaiter(); kullaniciKayit.BindingContext = new KullaniciKayitViewModel(kullaniciRepository); }); AnaEkranCommand = new Command(x => { AnaEkran anaekran = new AnaEkran(); Navigation.PushModalAsync(new NavigationPage(anaekran)).GetAwaiter(); // anaekran.BindingContext = new AnaEkranViewModel(Navigation,_sorularRepository, _doktorRepository, _hastaneRepository); }); GunlukCommand = new Command(x => { //Günlük }); HaftalikCommand = new Command(x => { //Haftalik }); }
public DoktorHemsireSayfasiViewModel(INavigation navigation, ISorularRepository sorularRepository, IDoktorRepository doktorRepository, IHastaneRepository hastaneRepository, IHemsireRepository hemsireRepository, IOdaRepository odalarRepository, IKoridorRepository koridorRepository , INesneRepository nesneRepository) { _doktorRepository = doktorRepository; _hastaneRepository = hastaneRepository; _odalarRepository = odalarRepository; _nesneRepository = nesneRepository; _soruRepository = sorularRepository; _koridorRepository = koridorRepository; Navigation = navigation; Sorularim = _soruRepository.QuerySoruAsync(x => !SoruyaCevapVerildiMi(x.ZamanPeridoyu, x.CevaplanmaZamani)).GetAwaiter().GetResult(); Odalars = _odalarRepository.GetOdaAsync().GetAwaiter().GetResult(); Koridors = _koridorRepository.GetKoridorAsync().GetAwaiter().GetResult(); Doktors = _doktorRepository.GetDoktorAsync().GetAwaiter().GetResult(); Nesnes = _nesneRepository.GetNesneAsync().GetAwaiter().GetResult(); var hastanes = _hastaneRepository.GetHastaneAsync().GetAwaiter().GetResult(); CevaplariGöster = new Command(x => { Cevaplar cevapKayit = new Cevaplar(); Navigation.PushModalAsync(cevapKayit).GetAwaiter(); cevapKayit.BindingContext = new CevaplarModelViewModel(sorularRepository, doktorRepository); }); AnaEkranCommand = new Command(x => { AnaEkran anaekran = new AnaEkran(); Navigation.PushModalAsync(new NavigationPage(anaekran)).GetAwaiter(); // anaekran.BindingContext = new AnaEkranViewModel(Navigation,_sorularRepository, _doktorRepository, _hastaneRepository); }); GunlukCommand = new Command(x => { Sorularim = _soruRepository.QuerySoruAsync(asd => asd.ZamanPeridoyu == "günlük" && !asd.CevaplandiMi).GetAwaiter().GetResult(); //Günlük }); HaftalikCommand = new Command(x => { Sorularim = _soruRepository.QuerySoruAsync(asd => asd.ZamanPeridoyu == "haftalık" && !asd.CevaplandiMi).GetAwaiter().GetResult(); //Haftalik }); AAAA = new Command(x => { if (_question != null) { //_question.Cevap = Cevap; _question.CevaplandiMi = true; if (_question.ZamanPeridoyu == "haftalik") { _question.CevaplanmaZamani = DateTime.Now.StartOfWeek(DayOfWeek.Monday); } else { _question.CevaplanmaZamani = DateTime.Now; // _question.CevapDate = DateTime.Now.; } _soruRepository.UpdateSoruAsync(_question); } }); }