Handle entities with id

No hierarchy is built anymore
WIP save issues after delete
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-02 19:12:16 +02:00
parent b61a9652d1
commit 36aa8914fa
26 changed files with 213 additions and 96 deletions

View File

@@ -0,0 +1,31 @@
using System.Threading.Tasks;
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Group.Commands.DeleteEntry
{
public class DeleteEntryCommand : IRequest
{
public string ParentGroupId { get; set; }
public string EntryId { get; set; }
public string RecycleBinName { get; set; }
public class DeleteEntryCommandHandler : IAsyncRequestHandler<DeleteEntryCommand>
{
private readonly IDatabaseProxy _database;
public DeleteEntryCommandHandler(IDatabaseProxy database)
{
_database = database;
}
public async Task Handle(DeleteEntryCommand message)
{
if (!_database.IsOpen) throw new DatabaseClosedException();
await _database.DeleteEntry(message.ParentGroupId, message.EntryId, message.RecycleBinName);
}
}
}
}