Exemple #1
0
        public ReviewValidator(int UserId, string UserToken, IRestaurantBuisness restaurantBuisness)
        {
            _restaurantBuisness = restaurantBuisness;


            RuleFor(m => m)
            .NotEmpty()
            .NotNull()
            .Must(r => BeAValidRestaurant(r, UserId, UserToken)).When(p => p.TblRestaurantId != 0).WithMessage("Invalid Restaurant");


            RuleFor(m => m.TblCustomerId)
            .NotEmpty()
            .NotNull()
            .Must(BeAValidCustomer).When(p => p.TblCustomerId != 0).WithMessage("Invalid Customer");

            RuleFor(m => m.Reviews)
            .NotEmpty()
            .NotNull()
            .MaximumLength(100).WithMessage("Reviews must be less than 100 characters");
        }
 public ReviewController(IRestaurantBuisness _business_Repo)
 {
     business_Repo = _business_Repo;
 }