Example #1
0
 public UpdateDeliveryCostCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.OrderId).MustAsync(OrderExists)
     .WithMessage("Заказ не найден.");
     RuleFor(x => x.DeliveryCost).GreaterThanOrEqualTo(0);
 }
Example #2
0
 public EditFoodCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.RestaurantId).MustAsync(RestaurantExists)
     .WithMessage("Ресторан не найден.");
     RuleFor(x => x.Food.Title).NotEmpty();
 }
Example #3
0
 public CreateOrderCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.RestaurantId).MustAsync(RestaurantExists)
     .WithMessage("Ресторан не найден.");
     RuleFor(x => x.OwnerId).MustAsync(UserExists)
     .WithMessage("Пользователь не найден.");
 }
Example #4
0
 public SetUserPaidStatusCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.OrderId).MustAsync(OrderExists)
     .WithMessage("Заказ не найден.");
     RuleFor(x => x.UserId).MustAsync(UserExists)
     .WithMessage("Пользователь не найден.");
 }
Example #5
0
 public UpdateRestaurantCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.Title).MaximumLength(100);
     RuleFor(x => x.Title).NotEmpty();
     RuleFor(x => x.Id).MustAsync(RestaurantExists)
     .WithMessage("Ресторан не найден.");
 }
Example #6
0
 public AddFoodCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.RestaurantId).MustAsync(RestaurantExists)
     .WithMessage("Ресторан не найден.");
     RuleFor(x => x.Food.Cost).GreaterThanOrEqualTo(0);
     RuleFor(x => x.Food.Title).NotEmpty();
 }
Example #7
0
 public DeleteFoodCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.RestaurantId).MustAsync(RestaurantExists)
     .WithMessage("Ресторан не найден.");
     RuleFor(x => x.Food).MustAsync(FoodExists)
     .WithMessage("Еда не найдена");
 }
Example #8
0
 public AddFoodOrderCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.OrderId).MustAsync(OrderExists)
     .WithMessage("Заказ не найден.");
     RuleFor(x => x.FoodOrder.FoodId).MustAsync(FoodExist)
     .WithMessage("Блюдо не найдено.");
     RuleFor(x => x.FoodOrder.UserId).MustAsync(UserExists)
     .WithMessage("Пользователь не найден.");
 }
 public CreateUserCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.Name).MaximumLength(100);
     RuleFor(x => x.Name).NotEmpty();
     RuleFor(x => x.PhoneNumber).MustAsync(UniquePhoneNumber)
     .When(x => !string.IsNullOrEmpty(x.PhoneNumber))
     .WithMessage("Номер телефона должен быть уникален.");
     RuleFor(x => x.PhoneNumber).Length(11)
     .When(x => !string.IsNullOrEmpty(x.PhoneNumber));
 }
 public IsFoodTitleTakenQueryHandler(IZakazakumContext context)
 {
     _context = context;
 }
Example #11
0
 public IsPhoneNumberTakenQueryHandler(IZakazakumContext context)
 {
     _context = context;
 }
 public AddFoodCommandHandler(IZakazakumContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public GetRestaurantsListQueryHandler(IZakazakumContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Example #14
0
 public SetUserPaidStatusCommandHandler(IZakazakumContext context)
 {
     _context = context;
 }
 public UpdateDeliveryCostCommandHandler(IZakazakumContext context)
 {
     _context = context;
 }
Example #16
0
 public CreateRestaurantCommandValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.Title).MaximumLength(100);
     RuleFor(x => x.Title).NotEmpty();
 }
Example #17
0
 public CreateUserCommandHandler(IZakazakumContext context)
 {
     _context = context;
 }
Example #18
0
 public GetOrderQueryHandler(IZakazakumContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public UpdateFoodOrderCommandHandler(IZakazakumContext context)
 {
     _context = context;
 }
 public IsFoodTitleTakenQueryValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.RestaurantId).MustAsync(RestaurantExists)
     .WithMessage("Ресторан не найден.");
 }
Example #21
0
 public GetOrderValidator(IZakazakumContext context)
 {
     _context = context;
     RuleFor(x => x.OrderId).MustAsync(OrderExists)
     .WithMessage("Заказ не найден.");
 }
 public GetFoodsListQueryQueryHandler(IZakazakumContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public SetOrderStatusCommandHandler(IZakazakumContext context)
 {
     _context = context;
 }
 public CreateRestaurantCommandHandler(IZakazakumContext context)
 {
     _context = context;
 }