Esempio n. 1
0
        // 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"));
        }
Esempio n. 2
0
        // 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));
        }
Esempio n. 3
0
        // 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));
        }
Esempio n. 4
0
        // 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());
        }
Esempio n. 5
0
        // 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));
        }
Esempio n. 6
0
        // 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());
        }
Esempio n. 7
0
        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)));
        }