Add project files.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using ConstructorAppUI.Dtos.ServiceDtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeAboutPartialComponent : ViewComponent
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string? _apiBaseUrl;
|
||||
|
||||
public _HomeAboutPartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
var responseMessage = await client.GetAsync($"{_apiBaseUrl}/api/Service");
|
||||
var jsonData = await responseMessage.Content.ReadAsStringAsync();
|
||||
var values = JsonConvert.DeserializeObject<List<ResultServiceDto>>(jsonData);
|
||||
return View(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using ConstructorAppUI.Dtos.HomeBannerDtos;
|
||||
using ConstructorAppUI.Dtos.SliderDtos;
|
||||
using ConstructorAppUI.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeBannerAndSliderPartialComponent : ViewComponent
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string? _apiBaseUrl;
|
||||
|
||||
public _HomeBannerAndSliderPartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
|
||||
var homeBannerResponse = await client.GetAsync($"{_apiBaseUrl}/api/HomeBanner");
|
||||
var sliderResponse = await client.GetAsync($"{_apiBaseUrl}/api/Slider");
|
||||
|
||||
var viewModel = new HomeBannerAndSliderViewModel();
|
||||
|
||||
if (homeBannerResponse.IsSuccessStatusCode)
|
||||
{
|
||||
var bannerJson = await homeBannerResponse.Content.ReadAsStringAsync();
|
||||
viewModel.HomeBanners = JsonConvert.DeserializeObject<List<ResultHomeBannerDto>>(bannerJson);
|
||||
}
|
||||
|
||||
if (sliderResponse.IsSuccessStatusCode)
|
||||
{
|
||||
var sliderJson = await sliderResponse.Content.ReadAsStringAsync();
|
||||
viewModel.Sliders = JsonConvert.DeserializeObject<List<ResultSliderDto>>(sliderJson);
|
||||
}
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using ConstructorAppUI.Dtos.CompanyInfoDtos;
|
||||
using ConstructorAppUI.Dtos.CompanyInfoVideoDtos;
|
||||
using ConstructorAppUI.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeCompanyInfoPartialComponent : ViewComponent
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string? _apiBaseUrl;
|
||||
|
||||
public _HomeCompanyInfoPartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
var companyInfoResponse = await client.GetAsync($"{_apiBaseUrl}/api/CompanyInfo");
|
||||
var companyInfoVideoResponse = await client.GetAsync($"{_apiBaseUrl}/api/CompanyInfoVideo");
|
||||
|
||||
var viewModel = new HomeCompanyInfoAndVideoViewModel();
|
||||
|
||||
if (companyInfoResponse.IsSuccessStatusCode)
|
||||
{
|
||||
var companyInfoJson = await companyInfoResponse.Content.ReadAsStringAsync();
|
||||
viewModel.CompanyInfo = JsonConvert.DeserializeObject<List<ResultCompanyInfoDto>>(companyInfoJson);
|
||||
}
|
||||
|
||||
if (companyInfoVideoResponse.IsSuccessStatusCode)
|
||||
{
|
||||
var companyInfoVideoJson = await companyInfoVideoResponse.Content.ReadAsStringAsync();
|
||||
var companyInfoVideoList = JsonConvert.DeserializeObject<List<ResultCompanyInfoVideoDto>>(companyInfoVideoJson);
|
||||
viewModel.CompanyInfoVideo = companyInfoVideoList?.FirstOrDefault();
|
||||
}
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using ConstructorAppUI.Dtos.ContactUsDtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeContactUsPartialComponent : ViewComponent
|
||||
{
|
||||
private readonly string _apiBaseUrl;
|
||||
|
||||
public _HomeContactUsPartialComponent(IConfiguration configuration)
|
||||
{
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public IViewComponentResult Invoke()
|
||||
{
|
||||
// ViewBag ile API base URL'sini taşıyoruz
|
||||
ViewBag.ApiBaseUrl = _apiBaseUrl;
|
||||
|
||||
var model = new CreateContactUsDto(); // Formu boş model ile başlatıyoruz
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using ConstructorAppUI.Dtos.ProjectDtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeProjectPartialComponent : ViewComponent
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string? _apiBaseUrl;
|
||||
|
||||
public _HomeProjectPartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
var responseMessage = await client.GetAsync($"{_apiBaseUrl}/api/Project");
|
||||
var jsonData = await responseMessage.Content.ReadAsStringAsync();
|
||||
var values = JsonConvert.DeserializeObject<List<ResultProjectDto>>(jsonData);
|
||||
return View(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using ConstructorAppUI.Dtos.ReferenceDtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeReferencePartialComponent : ViewComponent
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string? _apiBaseUrl;
|
||||
|
||||
public _HomeReferencePartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
var responseMessage = await client.GetAsync($"{_apiBaseUrl}/api/Reference");
|
||||
var jsonData = await responseMessage.Content.ReadAsStringAsync();
|
||||
var values = JsonConvert.DeserializeObject<List<ResultReferenceDto>>(jsonData);
|
||||
return View(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using ConstructorAppUI.Dtos.TeamDtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeTeamPartialComponent : ViewComponent
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string? _apiBaseUrl;
|
||||
|
||||
public _HomeTeamPartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
var responseMessage = await client.GetAsync($"{_apiBaseUrl}/api/Team");
|
||||
var jsonData = await responseMessage.Content.ReadAsStringAsync();
|
||||
var values = JsonConvert.DeserializeObject<List<ResultTeamDto>>(jsonData);
|
||||
return View(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using ConstructorAppUI.Dtos.TestimonialDtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeTestimonialPartialComponent : ViewComponent
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string? _apiBaseUrl;
|
||||
|
||||
public _HomeTestimonialPartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
var responseMessage = await client.GetAsync($"{_apiBaseUrl}/api/Testimonial");
|
||||
var jsonData = await responseMessage.Content.ReadAsStringAsync();
|
||||
var values = JsonConvert.DeserializeObject<List<ResultTestimonialDto>>(jsonData);
|
||||
return View(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using ConstructorAppUI.Dtos.WorkProcessDtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConstructorAppUI.ViewComponents.HomeComponents
|
||||
{
|
||||
public class _HomeWorkProcessPartialComponent : ViewComponent
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string? _apiBaseUrl;
|
||||
|
||||
public _HomeWorkProcessPartialComponent(IHttpClientFactory httpClientFactory, IConfiguration configuration)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_apiBaseUrl = configuration["ApiSettings:BaseUrl"];
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
var responseMessage = await client.GetAsync($"{_apiBaseUrl}/api/WorkProcess");
|
||||
var jsonData = await responseMessage.Content.ReadAsStringAsync();
|
||||
var values = JsonConvert.DeserializeObject<List<ResultWorkProcessDto>>(jsonData);
|
||||
return View(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user