2020-03-26 19:04:51 +01:00
|
|
|
|
using System.Collections.Generic;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
using System.Linq;
|
2020-03-26 19:04:51 +01:00
|
|
|
|
using MediatR;
|
|
|
|
|
using ModernKeePass.Application.Common.Interfaces;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
using ModernKeePass.Application.Parameters.Models;
|
2020-03-26 19:04:51 +01:00
|
|
|
|
|
2020-03-30 19:43:04 +02:00
|
|
|
|
namespace ModernKeePass.Application.Parameters.Queries.GetCiphers
|
2020-03-26 19:04:51 +01:00
|
|
|
|
{
|
|
|
|
|
public class GetCiphersQuery: IRequest<IEnumerable<CipherVm>>
|
|
|
|
|
{
|
|
|
|
|
public class GetCiphersQueryHandler: IRequestHandler<GetCiphersQuery, IEnumerable<CipherVm>>
|
|
|
|
|
{
|
2020-05-14 12:05:05 +02:00
|
|
|
|
private readonly IDatabaseSettingsProxy _databaseSettings;
|
2020-03-26 19:04:51 +01:00
|
|
|
|
|
2020-05-14 12:05:05 +02:00
|
|
|
|
public GetCiphersQueryHandler(IDatabaseSettingsProxy databaseSettings)
|
2020-03-26 19:04:51 +01:00
|
|
|
|
{
|
2020-05-14 12:05:05 +02:00
|
|
|
|
_databaseSettings = databaseSettings;
|
2020-03-26 19:04:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEnumerable<CipherVm> Handle(GetCiphersQuery message)
|
|
|
|
|
{
|
2020-05-14 12:05:05 +02:00
|
|
|
|
return _databaseSettings.Ciphers.Select(c => new CipherVm
|
2020-03-30 19:43:04 +02:00
|
|
|
|
{
|
|
|
|
|
Id = c.Id,
|
|
|
|
|
Name = c.Name
|
|
|
|
|
});
|
2020-03-26 19:04:51 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|