More queries/commands

This commit is contained in:
Geoffroy BONNEVILLE
2020-03-26 15:38:29 +01:00
parent a17d6b05ae
commit 903e7649e4
10 changed files with 118 additions and 29 deletions

View File

@@ -0,0 +1,23 @@
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
namespace ModernKeePass.Application.Resources.Queries
{
public class GetResourceQuery: IRequest<string>
{
public string Key { get; set; }
public class GetResourceQueryHandler: IRequestHandler<GetResourceQuery, string>
{
private readonly IResourceProxy _resourceProxy;
public GetResourceQueryHandler(IResourceProxy resourceProxy)
{
_resourceProxy = resourceProxy;
}
public string Handle(GetResourceQuery message)
{
return _resourceProxy.GetResourceValue(message.Key);
}
}
}
}