Ejemplo n.º 1
0
 public ApartmentAdDetailsQueryHandler(
     IApartmentAdRepository apartmentAdRepository,
     IBrokerRepository brokerRepository)
 {
     this.apartmentAdRepository = apartmentAdRepository;
     this.brokerRepository      = brokerRepository;
 }
Ejemplo n.º 2
0
 public DeleteApartmentAdCommandHandler(
     ICurrentUser currentUser,
     IApartmentAdRepository apartmentAdRepository,
     IBrokerRepository brokerRepository)
 {
     this.currentUser           = currentUser;
     this.apartmentAdRepository = apartmentAdRepository;
     this.brokerRepository      = brokerRepository;
 }
Ejemplo n.º 3
0
 public ChangeAvailabilityCommandHandler(
     ICurrentUser currentUser,
     IApartmentAdRepository apartmentAdRepository,
     IBrokerRepository brokerRepository)
 {
     this.currentUser           = currentUser;
     this.apartmentAdRepository = apartmentAdRepository;
     this.brokerRepository      = brokerRepository;
 }
Ejemplo n.º 4
0
        public CreateApartmentAdCommandValidator(IApartmentAdRepository apartmentAdRepository)
        {
            RuleFor(a => a.Category)
            .MustAsync(async(category, token) => await apartmentAdRepository
                       .GetCategory(category, token) != null)
            .WithMessage("'{PropertyName}' does not exist.");

            RuleFor(a => a.ImageUrl)
            .Must(url => Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute))
            .WithMessage("'{PropertyName}' must be a valid url.")
            .NotEmpty();

            RuleFor(a => a.HeatingType)
            .Must(BeAValidHeatingType)
            .WithMessage("'{PropertyName}' is not a valid heating type.");
        }
        public ApartmentAdCommandValidator(IApartmentAdRepository apartmentAdRepository)
        {
            this.RuleFor(c => c.Neighborhood)
            .MinimumLength(MinNameLength)
            .MaximumLength(MaxNameLength)
            .NotEmpty();

            this.RuleFor(c => c.Category)
            .MustAsync(async(category, token) => await apartmentAdRepository
                       .GetCategory(category, token) != null)
            .WithMessage("'{PropertyName}' does not exist.");

            this.RuleFor(c => c.ImageUrl)
            .Must(url => Uri.IsWellFormedUriString(url, UriKind.Absolute))
            .WithMessage("'{PropertyName}' must be a valid url.")
            .NotEmpty();

            this.RuleFor(c => c.PricePerMonth)
            .InclusiveBetween(Zero, decimal.MaxValue);

            this.RuleFor(c => c.HeatingType)
            .Must(Enumeration.HasValue <HeatingType>)
            .WithMessage("'Heating Type' is not valid.");
        }
 public EditApartmentAdCommandValidator(IApartmentAdRepository apartmentAdRepository)
 => this.Include(new ApartmentAdCommandValidator <EditApartmentAdCommand>(apartmentAdRepository));
 public SearchApartmentAdsQueryHandler(IApartmentAdRepository apartmentAdRepository)
 => this.apartmentAdRepository = apartmentAdRepository;