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

36 lines
998 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;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Bbs.Domain.Shared.Etos;
namespace Yi.Framework.Bbs.Domain.EventHandlers
{
public class SeeDiscussEventHandler : ILocalEventHandler<SeeDiscussEventArgs>, ITransientDependency
{
private IRepository<DiscussEntity, Guid> _repository;
2023-12-14 16:48:27 +08:00
public SeeDiscussEventHandler(IRepository<DiscussEntity, 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.SeeNum += 1;
await _repository.UpdateAsync(entity);
}
}
2023-12-14 16:48:27 +08:00
2023-12-14 14:38:46 +08:00
}
}