public ActionResult Etkinlik(EtkinlikFilter model) { EtkinlikListeConfig config = new EtkinlikListeConfig(); if (model.adet != 0) { config.setAdet(model.adet); } if (model.kategoriIds != null) { config.setKategoriIds(model.kategoriIds); } if (model.mekanIds != null) { config.setMekanIds(model.mekanIds); } if (model.sayfa != 0) { config.setSayfa(model.sayfa); } if (model.sehirIds != null) { config.setSehirIds(model.sehirIds); } if (model.turIds != null) { config.setTurIds(model.turIds); } EtkinlikListeResponse response = client.EtkinlikService.GetList(config); ViewBag.sayfalama = response.sayfalama; return(View(response.kayitlar)); }
public ActionResult SehirEtkinlik(string ids) { EtkinlikListeConfig config = new EtkinlikListeConfig(); config.setSehirIds(ids); EtkinlikListeResponse response = client.EtkinlikService.GetList(config); ViewBag.sayfalama = response.sayfalama; return(View("Etkinlik", response.kayitlar)); }
public EtkinlikListeResponse GetList(EtkinlikListeConfig config = null) { string queryString = config == null ? "" : "?" + config.Params().ToString(); HttpWebResponse response = client.ApiCall("/etkinlikler" + queryString); StreamReader reader = new StreamReader(response.GetResponseStream()); string result = reader.ReadToEnd(); switch (response.StatusCode) { case HttpStatusCode.OK: return JsonConvert.DeserializeObject<EtkinlikListeResponse>(result); case HttpStatusCode.Unauthorized: throw new UnauthorizedException(JsonConvert.DeserializeObject<GeneralErrorResponse>(result)); } throw new UnknownException(response); }