Files
modernkeepass/ModernKeePass.Application/Group/Commands/RemoveEntry/RemoveEntryCommand.cs
Geoffroy BONNEVILLE 2e22a2bd92 Added some translations in file pickers
Corrected key file creation picker issue (any not allowed)
Fixed some Sonar issues
2020-05-05 17:32:07 +02:00

30 lines
917 B
C#

using System.Threading.Tasks;
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Group.Commands.RemoveEntry
{
public class RemoveEntryCommand : IRequest
{
public string ParentGroupId { get; set; }
public string EntryId { get; set; }
public class RemoveEntryCommandHandler : IAsyncRequestHandler<RemoveEntryCommand>
{
private readonly IDatabaseProxy _database;
public RemoveEntryCommandHandler(IDatabaseProxy database)
{
_database = database;
}
public async Task Handle(RemoveEntryCommand message)
{
if (!_database.IsOpen) throw new DatabaseClosedException();
await _database.RemoveEntry(message.ParentGroupId, message.EntryId);
}
}
}
}