示例#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");
 }
        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");
        }
 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.");
 }
 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.");
 }
 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.");
 }
 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.");
        }
        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.");
        }
 public EfModifyCommentCommand(ProjekatContext context, ModifyCommentValidation validator)
 {
     _context   = context;
     _validator = validator;
 }
 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)
 {
 }
 public DatabaseUseCaseLogger(ProjekatContext context) => _context = context;
示例#26
0
 public EfDeleteGenreCommand(ProjekatContext context) : base(context)
 {
 }
 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)
 {
 }