using GxPress.Service.Interface.Media;
using GxPress.Repository.Interface.Category;
using GxPress.Repository.Interface.Media;
using System.Threading.Tasks;
using GxPress.Result.Media;

namespace GxPress.Service.Implement.Media
{
    public class MediaService : IMediaService
    {
        private readonly ICategoryRepository categoryRepository;
        private readonly IMediaRepository mediaRepository;
        public MediaService(ICategoryRepository categoryRepository, IMediaRepository mediaRepository)
        {
            this.categoryRepository = categoryRepository;
            this.mediaRepository = mediaRepository;
        }
        public async Task<bool> InsertAsync(MediaResult result)
        {

            // if (result.CategoryId > 0)
            // {
            //     result.CategoryName = await categoryRepository.GetCategoryParentAsync(result.CategoryId, result.CategoryName);
            // }
            return await mediaRepository.InsertAsync(result);
        }
    }
}