This commit is contained in:
mmrbnjd
2024-04-03 17:07:18 +03:30
parent 8e8bffa8a8
commit 0c470ce763
7 changed files with 131 additions and 5 deletions

View File

@@ -10,10 +10,12 @@ namespace Back.Services
{
private readonly IAsyncRepository<Pricing> _repoPricing;
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;
_repoBlog = repoBlog;
_repoQuestion = repoQuestion;
}
public async Task<List<BasePriceDto>> GetBasePrice()
{
@@ -37,6 +39,18 @@ namespace Back.Services
Photo=string.IsNullOrEmpty(s.Photo) ? "blog-SampleTitle.jpg" : s.Photo
}).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)
{
var result= await _repoBlog.Get(w => w.Status && w.ID==ID)