...
This commit is contained in:
@@ -31,6 +31,9 @@ namespace Back.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
[HttpGet("LastQuestion")]
|
||||||
|
public async Task<ActionResult<PagingDto<QuestionDto>>> LastQuestion(int PageIndex, int PageSize)
|
||||||
|
=> Ok(await _sBase.GetQuestion(PageIndex, PageSize));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,10 +10,12 @@ namespace Back.Services
|
|||||||
{
|
{
|
||||||
private readonly IAsyncRepository<Pricing> _repoPricing;
|
private readonly IAsyncRepository<Pricing> _repoPricing;
|
||||||
private readonly IAsyncRepository<Blog> _repoBlog;
|
private readonly IAsyncRepository<Blog> _repoBlog;
|
||||||
public ServBase(IAsyncRepository<Pricing> repoPricing, IAsyncRepository<Blog> repoBlog)
|
private readonly IAsyncRepository<Question> _repoQuestion;
|
||||||
|
public ServBase(IAsyncRepository<Pricing> repoPricing, IAsyncRepository<Blog> repoBlog, IAsyncRepository<Question> repoQuestion)
|
||||||
{
|
{
|
||||||
_repoPricing = repoPricing;
|
_repoPricing = repoPricing;
|
||||||
_repoBlog = repoBlog;
|
_repoBlog = repoBlog;
|
||||||
|
_repoQuestion = repoQuestion;
|
||||||
}
|
}
|
||||||
public async Task<List<BasePriceDto>> GetBasePrice()
|
public async Task<List<BasePriceDto>> GetBasePrice()
|
||||||
{
|
{
|
||||||
@@ -37,6 +39,18 @@ namespace Back.Services
|
|||||||
Photo=string.IsNullOrEmpty(s.Photo) ? "blog-SampleTitle.jpg" : s.Photo
|
Photo=string.IsNullOrEmpty(s.Photo) ? "blog-SampleTitle.jpg" : s.Photo
|
||||||
}).Paging(PageIndex, PageSize); ;
|
}).Paging(PageIndex, PageSize); ;
|
||||||
}
|
}
|
||||||
|
public async Task<PagingDto<QuestionDto>> GetQuestion(int PageIndex, int PageSize)
|
||||||
|
{
|
||||||
|
return await _repoQuestion.Get(w => w.Status)
|
||||||
|
.Include(inc=>inc.questionCategory).OrderByDescending(o => o.ID)
|
||||||
|
.Select(s => new QuestionDto
|
||||||
|
{
|
||||||
|
Answer=s.Answer,
|
||||||
|
Category=s.questionCategory.Title,
|
||||||
|
Title=s.Title,
|
||||||
|
ID = s.ID
|
||||||
|
}).Paging(PageIndex, PageSize);
|
||||||
|
}
|
||||||
public async Task<BlogDtoFull?> GetBlogByID(int ID)
|
public async Task<BlogDtoFull?> GetBlogByID(int ID)
|
||||||
{
|
{
|
||||||
var result= await _repoBlog.Get(w => w.Status && w.ID==ID)
|
var result= await _repoBlog.Get(w => w.Status && w.ID==ID)
|
||||||
|
16
Shared/DTOs/QuestionDto.cs
Normal file
16
Shared/DTOs/QuestionDto.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Shared.DTOs
|
||||||
|
{
|
||||||
|
public class QuestionDto
|
||||||
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
public string Category { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Answer { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -3,19 +3,19 @@
|
|||||||
<div class="col-xl-4 col-lg-6 col-md-6 mb-30">
|
<div class="col-xl-4 col-lg-6 col-md-6 mb-30">
|
||||||
<div class="tp-blog-item">
|
<div class="tp-blog-item">
|
||||||
<div class="tp-blog-thumb fix">
|
<div class="tp-blog-thumb fix">
|
||||||
<a href="@Navigation.ToAbsoluteUri($"/BlogDetails/{@Item.ID}")"><img src="img/blog/@Item.Photo" alt=""></a>
|
<a href="@Navigation.ToAbsoluteUri($"/BlogDetails/{@Item?.ID}")"><img src="img/blog/@Item?.Photo" alt=""></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="tp-blog-content">
|
<div class="tp-blog-content">
|
||||||
<div class="tp-blog-meta d-flex align-items-center">
|
<div class="tp-blog-meta d-flex align-items-center">
|
||||||
<div class="tp-blog-category category-color-1">
|
<div class="tp-blog-category category-color-1">
|
||||||
<span>@Item.Title.Split(':')[0]</span>
|
<span>@Item?.Title.Split(':')[0]</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="tp-blog-date">
|
<div class="tp-blog-date">
|
||||||
<span>@Item.Date</span>
|
<span>@Item?.Date</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tp-blog-title-box">
|
<div class="tp-blog-title-box">
|
||||||
<a class="tp-blog-title-sm" href="blog-details.html">@Item.Title.Split(':')[1]</a>
|
<a class="tp-blog-title-sm" href="blog-details.html">@Item?.Title.Split(':')[1]</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="tp-blog-author-info-box d-flex align-items-center">
|
<div class="tp-blog-author-info-box d-flex align-items-center">
|
||||||
<div class="tp-blog-avata">
|
<div class="tp-blog-avata">
|
||||||
|
20
TaxPayerFull/Layout/ItemQuestion.razor
Normal file
20
TaxPayerFull/Layout/ItemQuestion.razor
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@using Shared.DTOs
|
||||||
|
|
||||||
|
<div class="accordion-items">
|
||||||
|
<h2 class="accordion-header" id="headingOne">
|
||||||
|
<button class="accordion-buttons collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
|
||||||
|
@item.Title
|
||||||
|
<span class="accordion-btn"></span>
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="collapseOne" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
|
||||||
|
<div class="accordion-body">
|
||||||
|
@item.Answer
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public QuestionDto? item { get; set; }
|
||||||
|
}
|
70
TaxPayerFull/Layout/LQuestion.razor
Normal file
70
TaxPayerFull/Layout/LQuestion.razor
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
@using Shared.DTOs
|
||||||
|
@inject HttpClient _hc
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
<div class="tp-faq-area pt-50">
|
||||||
|
<div class="container p-0">
|
||||||
|
<div class="row g-0">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<h4 class="sv-details-title">سوالات پر تکرار</h4>
|
||||||
|
<div class="tp-custom-accordion">
|
||||||
|
<div class="accordion tp-inner-font" id="accordionExample">
|
||||||
|
|
||||||
|
@foreach (var item in request?.list)
|
||||||
|
{
|
||||||
|
<ItemQuestion Item="item" />
|
||||||
|
}
|
||||||
|
@* <ItemQuestion item="request?.list[0]" /> *@
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<nav aria-label="Page navigation">
|
||||||
|
<ul class="pagination justify-content-center">
|
||||||
|
@for (int page = 1; page <= request?.PageCount; page++)
|
||||||
|
{
|
||||||
|
if (page == PageIndex)
|
||||||
|
{
|
||||||
|
<li class="page-item disabled">
|
||||||
|
<a class="page-link" href="@Navigation.GetUriWithQueryParameter("PageIndex",page)">@(page)</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="@Navigation.GetUriWithQueryParameter("PageIndex",page)">@(page)</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter, SupplyParameterFromQuery]
|
||||||
|
public int? PageIndex { get; set; }
|
||||||
|
|
||||||
|
QuestionDto modeltest = new QuestionDto
|
||||||
|
{
|
||||||
|
Answer = "ندارد",
|
||||||
|
Category = "تست",
|
||||||
|
ID = 1,
|
||||||
|
Title = "دسته"
|
||||||
|
};
|
||||||
|
|
||||||
|
public Shared.DTOs.PagingDto<QuestionDto>? request { get; set; } = new PagingDto<QuestionDto>(1, 1, new List<QuestionDto>()
|
||||||
|
{
|
||||||
|
new QuestionDto
|
||||||
|
{
|
||||||
|
Answer="ندارد",Category="تست",ID=1,Title="دسته"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// protected override async Task OnParametersSetAsync()
|
||||||
|
// {
|
||||||
|
// if (PageIndex == null) PageIndex = 1;
|
||||||
|
// request = await _hc.GetFromJsonAsync<PagingDto<QuestionDto>>($"Base/LastQuestion?PageIndex={PageIndex ?? 1}&PageSize=6");
|
||||||
|
// await base.OnParametersSetAsync();
|
||||||
|
// }
|
||||||
|
}
|
@@ -374,6 +374,9 @@
|
|||||||
<!-- tp-project-area-start -->
|
<!-- tp-project-area-start -->
|
||||||
<Blog />
|
<Blog />
|
||||||
<!-- tp-project-area-end -->
|
<!-- tp-project-area-end -->
|
||||||
|
<!-- tp-question-start-->
|
||||||
|
<LQuestion />
|
||||||
|
<!--tp-question-end-->
|
||||||
<!-- tp-contact-area-Start -->
|
<!-- tp-contact-area-Start -->
|
||||||
<Contact />
|
<Contact />
|
||||||
<!-- tp-contact-area-end -->
|
<!-- tp-contact-area-end -->
|
||||||
|
Reference in New Issue
Block a user