using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using GxPress.Common.Page;
using GxPress.Request.Media;
using GxPress.Result.Media;
namespace GxPress.Service.Implement.Media
{
///
/// 明栏
///
public partial class MediaService
{
///
/// 明栏
///
///
public async Task> GetMediaStarLableResultAysnc()
{
var result = new List();
//获取明栏
var starLable = await systemLabelRepository.GetStarLableAllAsync();
foreach (var item in starLable)
{
var meidas = await systemLableMediaRepository.GetMediaIdsAsync(item.Id, 0);
var request = new MediaStarLableRequest()
{
Page = 1,
PerPage = item.PageSize,
MediaIds = meidas.ToList()
};
var mediaStarLableResult = new MediaStarLableResult()
{
Id = item.Id,
Name = item.LabelName,
Items = await mediaRepository.GetStarLablesAsync(request)
};
result.Add(mediaStarLableResult);
}
return result;
}
///
/// 明栏分页
///
///
public async Task> GetStarLablePageAsync(MediaStarLableRequest request)
{
var meidas = await systemLableMediaRepository.GetMediaIdsAsync(request.Id, 0);
if (meidas == null)
return new PagedList();
request.MediaIds = meidas.ToList();
return await mediaRepository.GetStarLablePageAsync(request);
}
}
}