public IndexBlogInceleResponse IndexBlogIncele(IndexSlugRequest indexSlugRequest)
        {
            Makaleler    makaleler    = _makalelerRepository.Find(x => x.Slug == indexSlugRequest.Slug);
            Kullanicilar kullanicilar = _kullanicilarRepository.Find(x => x.Id == makaleler.KullaniciIdi);
            Konular      konular      = _konularRepository.Find(x => x.Id == makaleler.KonuIdi);
            HttpClient   client2      = new HttpClient();

            client2.BaseAddress = new Uri("http://127.0.0.1:5000/");
            HttpResponseMessage responseMessage2 = client2.GetAsync("get_chain").Result;

            responseMessage2.EnsureSuccessStatusCode();
            var            responseBody = responseMessage2.Content.ReadAsStringAsync();
            GenelChainList emp          = responseMessage2.Content.ReadAsAsync <GenelChainList>().Result;

            IndexBlogInceleResponse indexBlogInceleResponse = new IndexBlogInceleResponse();

            indexBlogInceleResponse.AltBaslik      = makaleler.AltBaslik;
            indexBlogInceleResponse.Baslik         = makaleler.Baslik;
            indexBlogInceleResponse.Biyografi      = kullanicilar.Biyografi;
            indexBlogInceleResponse.Icerik         = makaleler.Icerik;
            indexBlogInceleResponse.KonuAdi        = konular.KonuAdi;
            indexBlogInceleResponse.KullaniciAdi   = kullanicilar.KullaniciAdi;
            indexBlogInceleResponse.KullaniciResim = kullanicilar.Resim;
            indexBlogInceleResponse.Tarih          = makaleler.Tarih;
            indexBlogInceleResponse.Resim          = makaleler.Resim;
            indexBlogInceleResponse.CoinSayisi     = emp.chain.SelectMany(x => x.transactions.Where(a => a.receiver == indexSlugRequest.Slug)).Sum(a => a.amount);
            indexBlogInceleResponse.YorumSayisi    = _yorumlarRepository.List(x => x.MakalelerIdi == makaleler.Id && x.Onaylanma == true).Count();

            List <YorumlarResponse> yorumlarRes = new List <YorumlarResponse>();

            foreach (var item in _yorumlarRepository.List(x => x.MakalelerIdi == makaleler.Id && x.Onaylanma == true))
            {
                yorumlarRes.Add(new YorumlarResponse()
                {
                    KullaniciAdi = item.AdSoyad, KullaniciResim = "bos.png", Yorum = item.YapilanYorum, YorumTarihi = item.YapilanTarih
                });
            }
            ;

            indexBlogInceleResponse.liste = yorumlarRes;

            return(indexBlogInceleResponse);
        }
コード例 #2
0
        public IActionResult PostBlogIncele(IndexSlugRequest indexSlugRequest)
        {
            var indexBlogInceleResponse = _kullaniciMakalelerAppService.IndexBlogIncele(indexSlugRequest);

            return(Ok(indexBlogInceleResponse));
        }