You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.0 KiB
65 lines
2.0 KiB
2 years ago
|
using System.Data;
|
||
|
using System.Threading.Tasks;
|
||
|
using Znyc.Admin.Commons.Services;
|
||
|
using Znyc.Admin.Security.Dtos;
|
||
|
using Znyc.Admin.Security.Entitys;
|
||
|
using Znyc.Admin.Security.IRepositories;
|
||
|
using Znyc.Admin.Security.IServices;
|
||
|
|
||
|
namespace Znyc.Admin.Security.Services
|
||
|
{
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
public class MessageService : BaseService<Message, MessageOutputDto, long>, IMessageService
|
||
|
{
|
||
|
private readonly IMessageRepository _messageRepository;
|
||
|
|
||
|
public MessageService(
|
||
|
IMessageRepository repository
|
||
|
) : base(repository)
|
||
|
{
|
||
|
_messageRepository = repository;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// ͬ������ʵ�塣
|
||
|
/// </summary>
|
||
|
/// <param name="entity">ʵ��</param>
|
||
|
/// <param name="trans">��������</param>
|
||
|
/// <returns></returns>
|
||
|
public override long Insert(Message entity, IDbTransaction trans = null)
|
||
|
{
|
||
|
entity.Id = Yitter.IdGenerator.YitIdHelper.NextId();
|
||
|
long result = repository.Insert(entity, trans);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// �첽����ʵ�塣
|
||
|
/// </summary>
|
||
|
/// <param name="entity">ʵ��</param>
|
||
|
/// <param name="id">����ID</param>
|
||
|
/// <param name="trans">��������</param>
|
||
|
/// <returns></returns>
|
||
|
public override async Task<bool> UpdateAsync(Message entity, long id, IDbTransaction trans = null)
|
||
|
{
|
||
|
bool result = await repository.UpdateAsync(entity, id, trans);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// �첽������ʵ�塣
|
||
|
/// </summary>
|
||
|
/// <param name="entity">ʵ��</param>
|
||
|
/// <param name="trans">��������</param>
|
||
|
/// <returns></returns>
|
||
|
public override async Task<int> InsertAsync(Message entity, IDbTransaction trans = null)
|
||
|
{
|
||
|
entity.Id = Yitter.IdGenerator.YitIdHelper.NextId();
|
||
|
int result = await repository.InsertAsync(entity, trans);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|