// DELETE: api/ApiWithActions/5 public IActionResult Delete(int id) { string url = Environment.GetEnvironmentVariable("ApiUrl"); url += "api/makale/MakaleDelete/" + id; HttpApiHelper helper = new HttpApiHelper(url, "Delete"); string response = helper.GetResponse(); return(RedirectToAction("MakaleHomePage")); }
// GET: api/Kategori public IActionResult GetKategori() { string url = Environment.GetEnvironmentVariable("ApiUrl"); url += "api/kategori/GetKategoriData"; HttpApiHelper helper = new HttpApiHelper(url, "GET"); string response = helper.GetResponse(); IEnumerable <Kategori> kategori = JsonConvert.DeserializeObject <IEnumerable <Kategori> >(response); return(View(kategori)); }
// PUT: api/Makale/5 public IActionResult MakaleUpdate(int id) { string url = Environment.GetEnvironmentVariable("ApiUrl"); url += "api/makale/GetMakale/" + id; HttpApiHelper helper = new HttpApiHelper(url, "GET"); string response = helper.GetResponse(); Makale makale = JsonConvert.DeserializeObject <Makale>(response); return(View(makale)); }
// PUT: api/Yorum/ public IActionResult YorumUpdate([FromBody] int id) { string url = Environment.GetEnvironmentVariable("ApiUrl"); url += "api/yorum/GetYorum/" + id; HttpApiHelper helper = new HttpApiHelper(url, "GET"); string response = helper.GetResponse(); Yorum makale = JsonConvert.DeserializeObject <Yorum>(response); return(View()); }
// GET: api/Makale public IActionResult MakaleHomePage() { string url = Environment.GetEnvironmentVariable("ApiUrl"); url += "api/makale/GetMakaleData"; HttpApiHelper helper = new HttpApiHelper(url, "GET"); string response = helper.GetResponse(); ViewBag.User = HttpContext.User.Identity.Name; IEnumerable <Makale> makale = JsonConvert.DeserializeObject <IEnumerable <Makale> >(response); return(View(makale)); }
// POST: api/Makale public IActionResult MakaleAdd() { string url = Environment.GetEnvironmentVariable("ApiUrl"); url += "api/kategori/GetKategoriData/"; HttpApiHelper helper = new HttpApiHelper(url, "GET"); //string response = helper.GetResponseWithModel(JsonConvert.SerializeObject(value)); string response = helper.GetResponse(); IEnumerable <Kategori> kategori = JsonConvert.DeserializeObject <IEnumerable <Kategori> >(response); ViewBag.Kategori = kategori.Select(k => new SelectListItem { Text = k.KategoriAdi, Value = k.KategoriId.ToString() }).ToList(); return(View()); }
public IActionResult MakaleGet(int id) { string url = Environment.GetEnvironmentVariable("ApiUrl"); url += "api/makale/GetMakale/" + id; HttpApiHelper helper = new HttpApiHelper(url, "GET"); string response = helper.GetResponse(); Makale makale = JsonConvert.DeserializeObject <Makale>(response); ViewBag.User = HttpContext.User.Identity.Name; url = Environment.GetEnvironmentVariable("ApiUrl"); url += "api/yorum/GetAllYorum/" + id; HttpApiHelper helperyorum = new HttpApiHelper(url, "GET"); response = helperyorum.GetResponse(); IEnumerable <Yorum> yorum = JsonConvert.DeserializeObject <IEnumerable <Yorum> >(response); return(View(Tuple.Create(yorum, makale))); }