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,48 @@
using ConstructorAppUI.Dtos.FooterDtos;
using ConstructorAppUI.Dtos.HomeBannerDtos;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace ConstructorAppUI.ViewComponents.HomeLayoutComponents
{
public class _HomeLayoutNavbarPartialComponent : ViewComponent
{
private readonly IHttpClientFactory _httpClientFactory;
private readonly string? _apiBaseUrl;
public _HomeLayoutNavbarPartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
{
_httpClientFactory = httpClientFactory;
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
}
public async Task<IViewComponentResult> InvokeAsync()
{
var client = _httpClientFactory.CreateClient();
// HomeBanner verisi çekiliyor
var responseMessage = await client.GetAsync($"{_apiBaseUrl}/api/HomeBanner");
var values = new List<ResultHomeBannerDto>();
if (responseMessage.IsSuccessStatusCode)
{
var jsonData = await responseMessage.Content.ReadAsStringAsync();
values = JsonConvert.DeserializeObject<List<ResultHomeBannerDto>>(jsonData);
}
// Footer verisi çekiliyor (telefon numarası için)
var footerResponse = await client.GetAsync($"{_apiBaseUrl}/api/Footer");
if (footerResponse.IsSuccessStatusCode)
{
var jsonFooter = await footerResponse.Content.ReadAsStringAsync();
var footerData = JsonConvert.DeserializeObject<List<ResultFooterDto>>(jsonFooter);
var phone = footerData.FirstOrDefault()?.Phone;
ViewBag.FooterPhone = phone;
}
return View(values);
}
}
}