36 lines
1004 B
C#
36 lines
1004 B
C#
using SPMS.Application.DTOs.Banner;
|
|
using SPMS.Application.Interfaces;
|
|
using SPMS.Domain.Interfaces;
|
|
|
|
namespace SPMS.Application.Services;
|
|
|
|
public class BannerService : IBannerService
|
|
{
|
|
private readonly IBannerRepository _bannerRepository;
|
|
|
|
public BannerService(IBannerRepository bannerRepository)
|
|
{
|
|
_bannerRepository = bannerRepository;
|
|
}
|
|
|
|
public async Task<BannerListResponseDto> GetListAsync(BannerListRequestDto request)
|
|
{
|
|
var items = await _bannerRepository.GetActiveListAsync(request.Position);
|
|
|
|
return new BannerListResponseDto
|
|
{
|
|
Items = items.Select(b => new BannerItemDto
|
|
{
|
|
BannerId = b.Id,
|
|
Title = b.Title,
|
|
ImageUrl = b.ImageUrl,
|
|
LinkUrl = b.LinkUrl,
|
|
LinkType = b.LinkType,
|
|
Position = b.Position,
|
|
SortOrder = b.SortOrder
|
|
}).ToList(),
|
|
TotalCount = items.Count
|
|
};
|
|
}
|
|
}
|