예제 #1
0
 public UserController(IMapper mapper, IApplicationActor actor, UseCaseExecutor executor)
 {
     _context      = new ProjekatContext();
     this.actor    = actor;
     this.executor = executor;
     _mapper       = mapper;
 }
예제 #2
0
 public PostController(IMapper mapper, CreatePostValidator validator, ProjekatContext context, UseCaseExecutor executor)
 {
     _context   = context;
     _mapper    = mapper;
     _validator = validator;
     _executor  = executor;
 }
예제 #3
0
        public CreateUserValidation(ProjekatContext context)
        {
            RuleFor(x => x.FirstName)
            .MinimumLength(2)
            .NotEmpty()
            .WithMessage("The Field FirstName must not be empty");

            RuleFor(x => x.LastName)
            .MinimumLength(2)
            .NotEmpty()
            .WithMessage("The Field LastName must not be empty");

            RuleFor(x => x.Email)
            .NotEmpty()
            .WithMessage("The Field Email must not be empty")
            .Must(x => !context.Users.Any(user => user.Email == x))
            .WithMessage("Username is alredy taken")
            .EmailAddress();

            RuleFor(x => x.Password)
            .MinimumLength(2)
            .NotEmpty()
            .WithMessage("The Field Password must not be empty");

            RuleFor(x => x.Username)
            .NotEmpty()
            .WithMessage("The Field Username must not be empty")
            .Must(x => !context.Users.Any(user => user.Username == x))
            .WithMessage("Username is alredy taken");
        }
 public CreateCategoryValidation(ProjekatContext context)
 {
     RuleFor(x => x.Name)
     .NotEmpty()
     .Must(x => !context.Categories.Any(c => c.Name == x))
     .WithMessage("Name of category must be unique");
 }
예제 #5
0
        public ModifyUserValidation(ProjekatContext context)
        {
            RuleFor(x => x.FirstName)
            .NotEmpty()
            .WithMessage("FirstName is required parametar");

            RuleFor(x => x.LastName)
            .NotEmpty()
            .WithMessage("LastName is required parametar");

            RuleFor(x => x.Email)
            .NotEmpty()
            .WithMessage("Email is required parametar")
            .Must(x => !context.Users.Any(user => user.Email == x))
            .WithMessage("Email is alredy taken");


            RuleFor(x => x.Password)
            .NotEmpty()
            .WithMessage("Email is required parametar");

            RuleFor(x => x.Username)
            .NotEmpty()
            .WithMessage("Email is required parametar")
            .Must(x => !context.Users.Any(user => user.Username == x))
            .WithMessage("Username is alredy taken");
        }
예제 #6
0
 public CreateGroupValidator(ProjekatContext context)
 {
     RuleFor(x => x.Name)
     .NotEmpty()
     .Must(name => !context.Groups.Any(g => g.Name == name))
     .WithMessage("Group name must be unique");
 }
예제 #7
0
 public UpdatePhotoValidator(ProjekatContext context)
 {
     RuleFor(x => x.Path)
     .NotEmpty()
     .WithMessage("Path is required parameter.")
     .Must((dto, path) => !context.Photos.Any(p => p.Path == path && p.Id != dto.Id))
     .WithMessage(p => $"Path already exists in database.");
 }
예제 #8
0
 public UpdateUserValidator(ProjekatContext context)
 {
     RuleFor(x => x.Email)
     .NotEmpty()
     .WithMessage("Email is required parameter.")
     .Must((dto, email) => !context.Users.Any(p => p.Email == email && p.Id != dto.Id))
     .WithMessage(p => $"Email with the name of {p.Email} already exists in database.");
 }
예제 #9
0
 public UpdatePostValidator(ProjekatContext context)
 {
     RuleFor(x => x.Name)
     .NotEmpty()
     .WithMessage("Name is required parameter.")
     .Must((dto, name) => !context.Posts.Any(p => p.Name == name && p.Id != dto.Id))
     .WithMessage(p => $"Post with the name of {p.Name} already exists in database.");
 }
예제 #10
0
 public UserController(IAddUserCommand createUser, IGetUsersQuery getUser, IEditUserCommand editUser, IDeleteUserCommand deleteUser, ProjekatContext context)
 {
     this.createUser = createUser;
     this.getUser    = getUser;
     this.editUser   = editUser;
     this.deleteUser = deleteUser;
     this.context    = context;
 }
예제 #11
0
 public ModifyCategoryValidation(ProjekatContext context)
 {
     RuleFor(x => x.Name)
     .NotEmpty()
     .WithMessage("Name of category not be empty")
     .Must(x => !context.Categories.Any(category => category.Name == x))
     .WithMessage("Name is alredy taken");
 }
예제 #12
0
 public GameController(IAddGameCommand createGame, IGetGamesQuery getGame, IGetSingleGameQuery getSingleGame, IEditGameCommand editGame, IDeleteGameCommand deleteGame, ProjekatContext context)
 {
     this.getGame       = getGame;
     this.editGame      = editGame;
     this.createGame    = createGame;
     this.deleteGame    = deleteGame;
     this.getSingleGame = getSingleGame;
     this.context       = context;
 }
예제 #13
0
        public CreateUserValidator(ProjekatContext context)
        {
            _context = context;

            RuleFor(x => x.Email)
            .NotEmpty()
            .WithMessage("Email is required parameter.")
            .Must(email => !_context.Users.Any(p => p.Email == email))
            .WithMessage(p => $"Email with the name of {p.Email} already exists in database.");
        }
예제 #14
0
 public ModifyCommentValidation(ProjekatContext context)
 {
     RuleFor(x => x.TextComment)
     .NotEmpty()
     .WithMessage("Text of comment not be empty");
     RuleFor(x => x.PostId)
     .NotNull()
     .WithMessage("IdPost not be null");
     RuleFor(x => x.UserId)
     .NotNull()
     .WithMessage("IdUser not be null");
 }
예제 #15
0
        public CreatePostValidation(ProjekatContext context)
        {
            RuleFor(x => x.Title)
            .NotEmpty()
            .MinimumLength(3)
            .Must(x => !context.Posts.Any(c => c.Title == x))
            .WithMessage("Title must be unique");

            RuleFor(x => x.Text)
            .NotEmpty()
            .MinimumLength(6)
            .WithMessage("You must not enter less than 6 characters");
        }
예제 #16
0
        public CreatePhotoValidator(ProjekatContext context)
        {
            _context = context;

            RuleFor(x => x.Name)
            .NotEmpty()
            .WithMessage("Name is required parameter.");
            RuleFor(x => x.Path)
            .NotEmpty()
            .WithMessage("Photo is required parameter.")
            .Must(path => !_context.Photos.Any(p => p.Path == path))
            .WithMessage(p => $"Path with the name of {p.Path} already exists in database.");
        }
예제 #17
0
        public RegisterUserValidator(ProjekatContext context)
        {
            RuleFor(x => x.FirstName).NotEmpty();
            RuleFor(x => x.LastName).NotEmpty();
            RuleFor(x => x.Password)
            .NotEmpty()
            .MinimumLength(6);


            RuleFor(x => x.Email)
            .NotEmpty()
            .EmailAddress()
            .Must(x => !context.Users.Any(user => user.Email == x))
            .WithMessage("Email is already taken.");
        }
예제 #18
0
 public EfModifyCommentCommand(ProjekatContext context, ModifyCommentValidation validator)
 {
     _context   = context;
     _validator = validator;
 }
예제 #19
0
 public EfRegisterUserCommand(ProjekatContext context, RegisterUserValidator validator, IEmailSender sender)
 {
     _context   = context;
     _validator = validator;
     _sender    = sender;
 }
 public EfDeleteConsolecommand(ProjekatContext context) : base(context)
 {
 }
예제 #21
0
 public EfCreateRateCommand(ProjekatContext context, IApplicationActor actor)
 {
     _context = context;
     _actor   = actor;
 }
예제 #22
0
 public EfAddGameCommand(ProjekatContext context) : base(context)
 {
 }
예제 #23
0
 public EfGetPostQuery(ProjekatContext context)
 {
     _context = context;
 }
예제 #24
0
 public EfGetGamesCommand(ProjekatContext context) : base(context)
 {
 }
예제 #25
0
 public DatabaseUseCaseLogger(ProjekatContext context) => _context = context;
예제 #26
0
 public EfDeleteGenreCommand(ProjekatContext context) : base(context)
 {
 }
예제 #27
0
 public EfDeleteCommentCommand(ProjekatContext context)
 {
     _context = context;
 }
예제 #28
0
 public EfLogUserCommand(ProjekatContext context) : base(context)
 {
 }
예제 #29
0
 public EfDeletePostCommand(ProjekatContext context)
 {
     this._context = context;
 }
예제 #30
0
 public EfGetRentsCommand(ProjekatContext context) : base(context)
 {
 }