mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Additional fields Add, Update and Delete work (too well)
SelectableListView works when programmatically setting selection
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using MediatR;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Domain.Exceptions;
|
||||
|
||||
namespace ModernKeePass.Application.Entry.Commands.DeleteField
|
||||
{
|
||||
public class DeleteFieldCommand: IRequest
|
||||
{
|
||||
public string EntryId { get; set; }
|
||||
public string FieldName { get; set; }
|
||||
|
||||
public class DeleteFieldCommandHandler : IRequestHandler<DeleteFieldCommand>
|
||||
{
|
||||
private readonly IDatabaseProxy _database;
|
||||
|
||||
public DeleteFieldCommandHandler(IDatabaseProxy database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public void Handle(DeleteFieldCommand message)
|
||||
{
|
||||
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||
|
||||
_database.DeleteField(message.EntryId, message.FieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,24 +2,24 @@
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Domain.Exceptions;
|
||||
|
||||
namespace ModernKeePass.Application.Entry.Commands.SetFieldValue
|
||||
namespace ModernKeePass.Application.Entry.Commands.UpsertField
|
||||
{
|
||||
public class SetFieldValueCommand : IRequest
|
||||
public class UpsertFieldCommand : IRequest
|
||||
{
|
||||
public string EntryId { get; set; }
|
||||
public string FieldName { get; set; }
|
||||
public object FieldValue { get; set; }
|
||||
|
||||
public class SetFieldValueCommandHandler : IRequestHandler<SetFieldValueCommand>
|
||||
public class UpsertFieldCommandHandler : IRequestHandler<UpsertFieldCommand>
|
||||
{
|
||||
private readonly IDatabaseProxy _database;
|
||||
|
||||
public SetFieldValueCommandHandler(IDatabaseProxy database)
|
||||
public UpsertFieldCommandHandler(IDatabaseProxy database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public void Handle(SetFieldValueCommand message)
|
||||
public void Handle(UpsertFieldCommand message)
|
||||
{
|
||||
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||
|
@@ -1,10 +1,10 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace ModernKeePass.Application.Entry.Commands.SetFieldValue
|
||||
namespace ModernKeePass.Application.Entry.Commands.UpsertField
|
||||
{
|
||||
public class SetFieldValueCommandValidator: AbstractValidator<SetFieldValueCommand>
|
||||
public class UpsertFieldCommandValidator: AbstractValidator<UpsertFieldCommand>
|
||||
{
|
||||
public SetFieldValueCommandValidator()
|
||||
public UpsertFieldCommandValidator()
|
||||
{
|
||||
RuleFor(v => v.EntryId)
|
||||
.NotNull()
|
Reference in New Issue
Block a user