using System.Threading.Tasks;
using GxPress.Repository.Interface.Attach;
using GxPress.Repository.Interface.Category;
using GxPress.Service.Interface.Attach;

namespace GxPress.Service.Implement.Attach
{
    public class AttachService : IAttachService
    {
        private readonly ICategoryRepository categoryRepository;
        private readonly IAttachRepository attachRepository;

        public AttachService(ICategoryRepository categoryRepository, IAttachRepository attachRepository)
        {
            this.categoryRepository = categoryRepository;
            this.attachRepository = attachRepository;
        }

        public async Task<int> InsertAsync(Entity.tede2.Attach.Attach note)
        {
            //note.CategoryName = await categoryRepository.GetCategoryParentAsync(note.CategoryId, note.CategoryName);
            return await attachRepository.InsertAsync(note);
        }

        public async Task<bool> UpdateAsync(Entity.tede2.Attach.Attach note)
        {
            //note.CategoryName = await categoryRepository.GetCategoryParentAsync(note.CategoryId, note.CategoryName);
            return await attachRepository.UpdateAsync(note);
        }
    }
}