public CreateJobReviewValidator(MovingContext context) { RuleFor(x => x.Description).NotEmpty().WithMessage("Description must not be empty"); RuleFor(x => x.JobId).NotEmpty() .Must(x => context.Jobs.Any(job => job.Id == x)) .WithMessage("Job does not exist"); }
public UpdateRoleValidator(MovingContext context) { RuleFor(x => x.Id).NotEmpty().GreaterThan(0).Must(x => context.Roles.Any(role => role.Id == x)).WithMessage("Role Id does not exist"); RuleFor(x => x.RoleName).NotEmpty() .WithMessage("Role name must not be empty"); RuleFor(x => x.PerimissionIds).NotEmpty().Must(x => x.All(d => context.Permissions.Any(f => f.Id == d))).WithMessage("Permission does not exist"); }
public CreateJobImageValidator(MovingContext context) { RuleFor(x => x.ImagePath).NotEmpty(); RuleFor(x => x.JobId).NotEmpty() .Must(x => context.Jobs.Any(job => job.Id == x)) .WithMessage("Job does not exist"); }
public RegisterUserValidator(MovingContext context) { RuleFor(x => x.FirstName).NotEmpty(); RuleFor(x => x.LastName).NotEmpty(); RuleFor(x => x.Password) .NotEmpty() .MinimumLength(6); RuleFor(x => x.UserName) .NotEmpty() .MinimumLength(4) .Must(x => !context.Users.Any(user => user.UserName == x)) .WithMessage("Username is already taken."); RuleFor(x => x.Email) .NotEmpty() .EmailAddress() .Must(x => !context.Users.Any(user => user.Email == x)) .WithMessage("Email is already taken."); RuleFor(x => x.RoleId) .NotEmpty() .Must(id => context.Roles.Any(x => x.Id == id)) .WithMessage("Role does not exist."); }
public CreateRoleValidator(MovingContext context) { RuleFor(x => x.Id).NotEmpty().GreaterThan(0).Must(x => !context.Roles.Any(role => role.Id == x)).WithMessage("Role Id already exists"); RuleFor(x => x.RoleName).NotEmpty() .Must(x => !context.Roles.Any(user => user.RoleName == x)) .WithMessage("Role name already exist"); RuleFor(x => x.PerimissionIds).NotEmpty().Must(x => x.All(d => context.Permissions.Any(f => f.Id == d))).WithMessage("Permission does not exist");; }
public UpdateCustomerValidator(MovingContext context) { RuleFor(x => x.FirstName) .NotEmpty() .MinimumLength(3) .WithMessage("Must be more than 3 characters"); RuleFor(x => x.LastName) .NotEmpty() .MinimumLength(3) .WithMessage("Must be more than 3 characters"); RuleFor(x => x.Id).NotEmpty(); }
public CreateCustomerValidator(MovingContext context) { RuleFor(x => x.FirstName) .NotEmpty() .MinimumLength(3) .WithMessage("Must be more than 3 characters"); RuleFor(x => x.LastName) .NotEmpty() .MinimumLength(3) .WithMessage("Must be more than 3 characters"); RuleFor(x => x.Email) .NotEmpty() .EmailAddress() .Must(x => !context.Customers.Any(cust => cust.Email == x)) .WithMessage("Email already exist in the database"); }
public UpdateUserValidator(MovingContext context) { RuleFor(x => x.Id).NotEmpty().Must(x => context.Users.Any(user => user.Id == x)).WithMessage("User Id does not exist"); RuleFor(x => x.FirstName).NotEmpty(); RuleFor(x => x.LastName).NotEmpty(); RuleFor(x => x.Password) .NotEmpty() .MinimumLength(6); RuleFor(x => x.UserName) .NotEmpty() .MinimumLength(4); RuleFor(x => x.Email) .NotEmpty() .EmailAddress(); RuleFor(x => x.RoleId) .NotEmpty() .Must(id => context.Roles.Any(x => x.Id == id)) .WithMessage("Role does not exist."); }
public UpdateJobValidator(MovingContext context) { RuleFor(x => x.Id).NotEmpty(); RuleFor(x => x.MoveDate).NotEmpty().Must(o => o.AddDays(30) > o); RuleFor(x => x.JobTypeId).NotEmpty() .Must(x => context.JobTypes.Any(user => user.Id == x)) .WithMessage("Job Type does not exist"); RuleFor(x => x.MinimumHours) .NotEmpty() .GreaterThanOrEqualTo(3) .WithMessage("Minimum hours must be 3 or more"); RuleFor(x => x.NumberOfMovers) .NotEmpty() .InclusiveBetween(2, 10) .WithMessage("Minimum number of movers is 2, maximum is 10"); RuleFor(x => x.NumberOfTrucks) .NotEmpty() .InclusiveBetween(1, 3) .WithMessage("Minimum number of truck is 1, maximum is 3");; RuleFor(x => x.PricePerHour).NotEmpty(); RuleFor(x => x.CustomerId).NotEmpty() .Must(x => context.Customers.Any(user => user.Id == x)) .WithMessage("Customer does not exist"); }
public JwtManager(MovingContext context, string issuer, string secretKey) { _context = context; _issuer = issuer; _secretKey = secretKey; }
public DatabaseUseCaseLogger(MovingContext context) => _context = context;
public EfDeleteCustomerCommand(MovingContext context) { this._context = context; }
public EfDeleteJobCommand(MovingContext context) { this._context = context; }
public EfUpdateCustomerCommand(MovingContext context, UpdateCustomerValidator validator) { _context = context; _validator = validator; }
public EfGetJobReviewQuery(MovingContext context, IMapper mapper) { this.context = context; _mapper = mapper; }
public EfGetUseCaseLogsQuery(MovingContext context, IMapper mapper) { this.context = context; _mapper = mapper; }
public EFGetRolesQuery(MovingContext context, IMapper mapper) { this.context = context; _mapper = mapper; }
public CustomersController(MovingContext context) { _context = context; }
public EfGetCustomersQuery(MovingContext context, IMapper mapper) { this.context = context; _mapper = mapper; }
public EfUpdateRoleCommand(MovingContext context, UpdateRoleValidator validator) { _context = context; _validator = validator; }
public EfUpdateUserCommand(MovingContext context, UpdateUserValidator validator, IEmailSender sender) { _context = context; _validator = validator; _sender = sender; }
public EfCreateJobReviewCommand(MovingContext context, CreateJobReviewValidator validator) { _context = context; _validator = validator; }
public EfCreateJobImageCommand(MovingContext context, CreateJobImageValidator validator) { _context = context; _validator = validator; }