public UpdateTodoListItemCommandValidator(ITodoListItemsRepository todoListItemsRepository) { RuleFor(model => model.TodoListItemId) .MustAsync((todoListItemId, cancellation) => todoListItemsRepository.AnyAsync(x => x.TodoListItemId == todoListItemId, cancellation)) .WithMessage("The to-do item associated with this transaction was not found."); RuleFor(model => model.Name) .NotEmpty() .WithMessage("Name must not be empty"); RuleFor(model => model.Description) .MaximumLength(500) .WithMessage(model => $"Description must be less than 500 characters long. Current length: {model.Description.Length}") .When(model => !string.IsNullOrWhiteSpace(model.Description)); }
public DeleteTodoListItemCommandValidator(ITodoListItemsRepository todoListItemsRepository) { RuleFor(model => model.TodoListItemId) .MustAsync((todoListItemId, cancellation) => todoListItemsRepository.AnyAsync(x => x.TodoListItemId == todoListItemId, cancellation)) .WithMessage("The to-do item associated with this transaction was not found."); }
public GetTodoListItemsQueryHandler(ITodoListItemsRepository todoListItemsRepository, IMapper mapper) { _todoListItemsRepository = todoListItemsRepository; _mapper = mapper; }
public DeleteTodoListItemCommandHandler(ITodoListItemsRepository todoListItemsRepository , IValidator <DeleteTodoListItemCommand> validator) { _todoListItemsRepository = todoListItemsRepository; _validator = validator; }
public MarkAsDoneTodoListItemCommandHandler(ITodoListItemsRepository todoListItemsRepository , IValidator <MarkAsDoneTodoListItemCommand> validator) { _todoListItemsRepository = todoListItemsRepository; _validator = validator; }