34 lines
882 B
C#
34 lines
882 B
C#
using SPMS.Application.DTOs.Faq;
|
|
using SPMS.Application.Interfaces;
|
|
using SPMS.Domain.Interfaces;
|
|
|
|
namespace SPMS.Application.Services;
|
|
|
|
public class FaqService : IFaqService
|
|
{
|
|
private readonly IFaqRepository _faqRepository;
|
|
|
|
public FaqService(IFaqRepository faqRepository)
|
|
{
|
|
_faqRepository = faqRepository;
|
|
}
|
|
|
|
public async Task<FaqListResponseDto> GetListAsync(FaqListRequestDto request)
|
|
{
|
|
var items = await _faqRepository.GetActiveListAsync(request.Category);
|
|
|
|
return new FaqListResponseDto
|
|
{
|
|
Items = items.Select(f => new FaqItemDto
|
|
{
|
|
FaqId = f.Id,
|
|
Category = f.Category,
|
|
Question = f.Question,
|
|
Answer = f.Answer,
|
|
SortOrder = f.SortOrder
|
|
}).ToList(),
|
|
TotalCount = items.Count
|
|
};
|
|
}
|
|
}
|