public RegisterUserValidator(MoviePlusContext context) { RuleFor(x => x.FirstName) .NotEmpty() .Length(3, 32); RuleFor(x => x.LastName) .NotEmpty() .Length(4, 32); RuleFor(x => x.Username) .NotEmpty() .Length(4, 32) .Must(x => !context.Users.Any(u => u.Username == x)) .WithMessage("Username must be unique"); RuleFor(x => x.Password) .NotEmpty() .Length(4, 32); RuleFor(x => x.Email) .NotEmpty() .EmailAddress() .Must(x => !context.Users.Any(u => u.Email == x)) .WithMessage("Email must be unique"); }
public InsertAuditoriumValidator(MoviePlusContext context) { RuleFor(x => x.Name) .NotEmpty() .Length(2, 40) .Must(x => !context.Auditoriums.Any(a => a.Name == x)) .WithMessage("Auditorium name must be unique"); }
public UpdateUserValidator(MoviePlusContext context) { RuleFor(x => x.Username) .Must((dto, username) => !context.Users.Any(u => u.Username == username && u.Id != dto.Id)) .WithMessage(u => $"User with ({u.Username}) already exists in database."); RuleFor(x => x.Email) .Must((dto, email) => !context.Users.Any(u => u.Email == email && u.Id != dto.Id)) .WithMessage(u => $"Email ({u.Email}) is taken, try different one."); }
public UpdateScreeningValidator(MoviePlusContext context) { RuleFor(x => x.MovieId) .NotEmpty(); RuleFor(x => x.AuditoriumId) .NotEmpty(); RuleFor(x => x.ScreeningTime) .NotEmpty() .GreaterThan(DateTime.Now) .WithMessage("Date must not be in past"); }
public UpdateSeatValidator(MoviePlusContext context) { RuleFor(x => x.AuditoriumName) .NotEmpty() .Length(2, 40) .Must(name => context.Auditoriums.Any(a => a.Name == name)) .WithMessage(dto => $"{dto.AuditoriumName} does not exists as Auditorium in database"); RuleFor(x => x.Number) .NotEmpty() .GreaterThan(0) .Must((dto, number) => !context.Seats.Any(a => a.Number == number && a.Auditorium.Name == dto.AuditoriumName)) .WithMessage(s => $"Seat number {s.Number} already exists in {s.AuditoriumName}"); }
public UpdateMovieValidator(MoviePlusContext context) { RuleFor(x => x.Title) .NotEmpty() .Must((dto, name) => !context.Movies.Any(p => p.Title == name && p.Id != dto.Id)) //Posto je update pitamo jos da li naziv proizvoda postoji vec unutar baze ali sa razlicitim ID .WithMessage("Title name already exists in database"); RuleFor(x => x.Description) .NotEmpty() .Must((dto, name) => !context.Movies.Any(p => p.Description == name && p.Id != dto.Id)) .WithMessage("Description name already exists in database"); RuleFor(x => x.Duration) .NotEmpty() .GreaterThan(0) .LessThan(300); RuleFor(x => x.Image) .NotEmpty(); }
public InsertMovieValidator(MoviePlusContext context) { RuleFor(x => x.Title) .NotEmpty() .Length(2, 100) .Must(x => !context.Movies.Any(u => u.Title == x)) .WithMessage("Title must be unique"); RuleFor(x => x.Description) .NotEmpty() .Length(2, 1500) .Must(x => !context.Movies.Any(u => u.Description == x)) .WithMessage("Description must be unique"); RuleFor(x => x.Duration) .NotEmpty() .GreaterThan(0) .LessThan(300); RuleFor(x => x.Image) .NotEmpty(); }
public GetSingleScreeningQuery(MoviePlusContext context) { _context = context; }
public JwtManager(MoviePlusContext context, string issuer, string secretKey) { _context = context; _issuer = issuer; _secretKey = secretKey; }
public GetUsersQuery(MoviePlusContext context) { _context = context; }
public GetScreening(MoviePlusContext context) { _context = context; }
public DeleteReservation(MoviePlusContext context) { _context = context; }
public GetAuditoriumsQuery(MoviePlusContext context) { _context = context; }
public UpdateUser(MoviePlusContext context, UpdateUserValidator validator, IApplicationUser actor) { _context = context; _validator = validator; _actor = actor; }
public DatabaseUseCaseLogger(MoviePlusContext context) { _context = context; }
public DeleteScreening(MoviePlusContext context) { _context = context; }
public DeleteUser(MoviePlusContext context) { _context = context; }
public DeleteMovie(MoviePlusContext context) { _context = context; }
public ReservationInsert(MoviePlusContext context, IEmailSender email) { _context = context; _email = email; }
public GetSeatsQuery(MoviePlusContext context) { _context = context; }
public SeatInsert(MoviePlusContext context, InsertSeatValidator validator) { _context = context; _validator = validator; }
public UpdateAuditoriumValidator(MoviePlusContext context) { RuleFor(x => x.Name) .Must((dto, name) => !context.Auditoriums.Any(a => a.Name == name && a.Id != dto.Id)) .WithMessage(a => $"Auditorium ({a.Name}) already exists in database"); }
public InsertScreening(MoviePlusContext context, InsertScreeningValidator validator) { _context = context; _validator = validator; }
public AuditoriumUpdate(MoviePlusContext context, UpdateAuditoriumValidator validator) { _context = context; _validator = validator; }
public MovieInsert(MoviePlusContext context, InsertMovieValidator validator) { _context = context; _validator = validator; }
public GetSingleMovie(MoviePlusContext context) { _context = context; }
public GetLogQuery(MoviePlusContext context) { _context = context; }
public GetSingleSeatQuery(MoviePlusContext context, IApplicationUser actor) { _context = context; _actor = actor; }
public GetReservation(MoviePlusContext context) { _context = context; }
public DeleteAuditorium(MoviePlusContext context) { _context = context; }