Files
Yi.Admin/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/SeeDiscussEventHandler.cs

32 lines
1017 B
C#
Raw Normal View History

2023-12-14 14:38:46 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus;
2024-01-11 18:51:53 +08:00
using Yi.Framework.Bbs.Domain.Entities.Forum;
2023-12-14 14:38:46 +08:00
using Yi.Framework.Bbs.Domain.Shared.Etos;
2024-01-27 17:42:09 +08:00
namespace Yi.Framework.Bbs.Domain.EventHandlers
2023-12-14 14:38:46 +08:00
{
public class SeeDiscussEventHandler : ILocalEventHandler<SeeDiscussEventArgs>, ITransientDependency
{
2024-05-22 14:35:08 +08:00
private IRepository<DiscussAggregateRoot, Guid> _repository;
public SeeDiscussEventHandler(IRepository<DiscussAggregateRoot, Guid> repository)
2023-12-14 14:38:46 +08:00
{
_repository = repository;
}
2023-12-14 16:48:27 +08:00
public async Task HandleEventAsync(SeeDiscussEventArgs eventData)
2023-12-14 14:38:46 +08:00
{
var entity = await _repository.GetAsync(eventData.DiscussId);
if (entity is not null)
{
entity.AddSeeNumber();
2023-12-14 14:38:46 +08:00
await _repository.UpdateAsync(entity);
}
}
}
}