public ActionResult Index(Guid isAtamaId) { var gorevData = new IsAtamaRepo().Queryable().First(x => x.Id == isAtamaId); var gorev = new GorevViewModel { IsAtamaId = gorevData.Id, Baslik = gorevData.Sema.Baslik, Aciklama = gorevData.Aciklama, BaslangicTarihi = gorevData.BaslangicTarihi, SonTarih = gorevData.SonTarih, AdimSirasi = gorevData.SonAdim.Sira, ToplamAdim = gorevData.Sema.AdimSayisi, TamamlandiMi = gorevData.TamamlandiMi }; var adim = new AdimViewModel { Baslik = gorevData.SonAdim.Baslik, YonlendirmeUrl = gorevData.SonAdim.YonlendirmeUrl, Sira = gorevData.SonAdim.Sira }; var model = new IsSureciViewModel { Gorev = gorev, Adim = adim }; return(View(model)); }
public async Task <ActionResult> Edit(int id) { GorevViewModel gorev = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri(apiBaseAddress); var httpResponse = await client.GetAsync($"Gorev/{id}"); if (httpResponse.IsSuccessStatusCode) { gorev = await httpResponse.Content.ReadAsAsync <GorevViewModel>(); } else { ModelState.AddModelError(string.Empty, "Server error."); } } if (gorev == null) { return(HttpNotFound()); } return(View(gorev)); }
public async Task <ActionResult> Details(int Id) { KullaniciViewModel kullanici = null; SirketViewModel sirket = null; GorevViewModel gorev = null; String sirketAdi = ""; String gorevAdi = ""; using (var client = new HttpClient()) { client.BaseAddress = new Uri(apiBaseAddress); var httpResponseKullanici = await client.GetAsync($"Kullanici/{Id}"); if (httpResponseKullanici.IsSuccessStatusCode) { kullanici = await httpResponseKullanici.Content.ReadAsAsync <KullaniciViewModel>(); var httpResponseSirket = await client.GetAsync($"Sirket/{kullanici.Sirket}"); if (httpResponseSirket.IsSuccessStatusCode) { sirket = await httpResponseSirket.Content.ReadAsAsync <SirketViewModel>(); sirketAdi = sirket.SirketAdi; ViewBag.SirketAdi = sirketAdi; } if (kullanici.Gorev != null) { var httpResponseGorev = await client.GetAsync($"Gorev/{kullanici.Gorev}"); if (httpResponseGorev.IsSuccessStatusCode) { gorev = await httpResponseGorev.Content.ReadAsAsync <GorevViewModel>(); gorevAdi = gorev.GorevAdi; ViewBag.GorevAdi = gorevAdi; } } } else { ModelState.AddModelError(string.Empty, "Server error."); } } if (kullanici == null) { return(HttpNotFound()); } return(View(kullanici)); }