Files
modernkeepass/ModernKeePass.Application/Parameters/Commands/SetRecycleBin/SetRecycleBinCommand.cs
Geoffroy BONNEVILLE b875f3c89d Adding entries and groups works again
Entry history almost fully functional
Some refactoring
2020-04-03 17:33:53 +02:00

27 lines
829 B
C#

using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Parameters.Commands.SetRecycleBin
{
public class SetRecycleBinCommand : IRequest
{
public string RecycleBinId { get; set; }
public class SetRecycleBinCommandHandler : IRequestHandler<SetRecycleBinCommand>
{
private readonly IDatabaseProxy _database;
public SetRecycleBinCommandHandler(IDatabaseProxy database)
{
_database = database;
}
public void Handle(SetRecycleBinCommand message)
{
if (_database.IsOpen) _database.SetRecycleBin(message.RecycleBinId);
else throw new DatabaseClosedException();
}
}
}
}