Add project files.

This commit is contained in:
2025-05-01 15:18:30 +03:00
parent e058ab8015
commit 774d695414
3094 changed files with 1336814 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using ConstructorAppUI.Dtos.FooterDtos;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace ConstructorAppUI.ViewComponents.HomeLayoutComponents
{
public class _HomeLayoutFooterPartialComponent : ViewComponent
{
private readonly IHttpClientFactory _httpClientFactory;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly string _apiBaseUrl;
public _HomeLayoutFooterPartialComponent(IHttpClientFactory httpClientFactory, IWebHostEnvironment webHostEnvironment, IConfiguration configuration)
{
_httpClientFactory = httpClientFactory;
_webHostEnvironment = webHostEnvironment;
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
}
public async Task<IViewComponentResult> InvokeAsync()
{
var client = _httpClientFactory.CreateClient();
var responseMessage = await client.GetAsync($"{_apiBaseUrl}/api/Footer");
if (responseMessage.IsSuccessStatusCode)
{
var jsonData = await responseMessage.Content.ReadAsStringAsync();
var values = JsonConvert.DeserializeObject<List<ResultFooterDto>>(jsonData);
// Sadece ilk öğeyi gönderecek şekilde güncelleyin
return View(values.FirstOrDefault());
}
return View();
}
}
}