示例#1
0
 public EfRegisterUserCommand(RegisterUserValidator validator, PerfumeContext context, IMapper mapper, IEmailSender sender)
 {
     _validator = validator;
     _context   = context;
     _mapper    = mapper;
     _sender    = sender;
 }
示例#2
0
 public EfAddInCartCommand(PerfumeContext context, IMapper mapper, AddInCartValidator validator, IApplicationActor actor)
 {
     _context   = context;
     _mapper    = mapper;
     _validator = validator;
     _actor     = actor;
 }
示例#3
0
 public UpdateCartQuantityValidator(PerfumeContext context)
 {
     RuleFor(x => x.Quantity)
     .NotEmpty().WithMessage("You must enter quantity")
     .GreaterThan(-1).WithMessage("Quantity cant be less than zero.");
     RuleFor(x => x.PerfumeId).NotEmpty()
     .Must(x => context.Carts.Any(c => c.PerfumeId == x)).WithMessage("This perfume doesn't exist in your cart.");
 }
 public AddInCartValidator(PerfumeContext context)
 {
     RuleFor(x => x.Quantity)
     .NotEmpty().WithMessage("You must enter quantity")
     .GreaterThan(0).WithMessage("Quantity must be at least 1.");
     RuleFor(x => x.PerfumeId).NotEmpty()
     .Must(x => context.Perfumes.Any(p => p.Id == x)).WithMessage("Perfume with that id doesn't exist.");
 }
        public RegisterUserValidator(PerfumeContext context)
        {
            RuleFor(x => x.FirstName)
            .NotEmpty().MaximumLength(25);

            RuleFor(x => x.LastName)
            .NotEmpty().MaximumLength(25);

            RuleFor(x => x.Username)
            .Must(x => !context.Users.Any(u => u.Username == x))
            .WithMessage("Username is already in use.")
            .NotEmpty().MinimumLength(5).MaximumLength(25);

            RuleFor(x => x.Password)
            .NotEmpty().MinimumLength(5).MaximumLength(25);

            RuleFor(x => x.Email)
            .NotEmpty().EmailAddress().MaximumLength(25);
            RuleFor(x => x.Address)
            .NotEmpty().MinimumLength(4);
        }
 public EfCreateOrderCommand(PerfumeContext context, IMapper mapper, IApplicationActor actor)
 {
     _context = context;
     _mapper  = mapper;
     _actor   = actor;
 }
示例#7
0
 public HomeController(PerfumeContext context)
 {
     db = context;
 }
 public EfGetPerfumesByFragranceTypeQuery(PerfumeContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public EfUserUseCaseDeleteCommand(PerfumeContext context)
 {
     _context = context;
 }
示例#10
0
 public DbUseCaseLogger(PerfumeContext context) => _context = context;
 public EfGetBrandWithPerfumes(PerfumeContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public EfDeleteFromCartCommand(PerfumeContext context)
 {
     _context = context;
 }
示例#13
0
 public EfDeletePerfumeCommand(PerfumeContext context)
 {
     _context = context;
 }
 public EfUpdateBrandCommand(PerfumeContext context, UpdateBrandValidator validator)
 {
     _context   = context;
     _validator = validator;
 }
 public EfGetYourCartQuery(PerfumeContext context, IMapper mapper, IApplicationActor actor)
 {
     _context = context;
     _mapper  = mapper;
     _actor   = actor;
 }
 public EfCreateBrandCommand(PerfumeContext context, CreateBrandValidator validator, IMapper mapper)
 {
     _context   = context;
     _validator = validator;
     _mapper    = mapper;
 }
 public UpdateBrandValidator(PerfumeContext context)
 {
     RuleFor(x => x.Name).MinimumLength(1).WithMessage("Brand Name cannot have less than 1 caracter.");
     RuleFor(x => x.Id).NotEmpty().WithMessage("You must enter an id of the product you want to edit.")
     .Must(x => context.Brands.Any(u => u.Id == x)).WithMessage("Brand with that Id doesn't exist.");
 }
示例#18
0
 public EfGetAuditLogs(PerfumeContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public EfCreatePerfumeCommand(IMapper mapper, PerfumeContext context, CreatePerfumeValidator validator)
 {
     _mapper    = mapper;
     _context   = context;
     _validator = validator;
 }
 public EfUpdateCartQuantity(PerfumeContext context, UpdateCartQuantityValidator validator, IApplicationActor actor)
 {
     _context   = context;
     _validator = validator;
     _actor     = actor;
 }
示例#21
0
 public EfGetGenders(PerfumeContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public EfAddUserUseCaseCommand(PerfumeContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
示例#23
0
        public static void Initialize(PerfumeContext context)
        {
            if (!context.Brands.Any())
            {
                context.Brands.AddRange(
                    new Brand
                {
                    Name    = "Chanel",
                    Country = "France"
                },
                    new Brand
                {
                    Name    = "Eclat d’Arpege",
                    Country = "France"
                },
                    new Brand
                {
                    Name    = "Lanvin",
                    Country = "France"
                },
                    new Brand
                {
                    Name    = "Armani",
                    Country = "Italy"
                },
                    new Brand
                {
                    Name    = "Versace",
                    Country = "Italy"
                },
                    new Brand
                {
                    Name    = "Givenchy",
                    Country = "France"
                },
                    new Brand
                {
                    Name    = "Burberry",
                    Country = "UK"
                },
                    new Brand
                {
                    Name    = "Kenzo",
                    Country = "French"
                }
                    );
                context.SaveChanges();
            }

            if (!context.Perfumes.Any())
            {
                context.Perfumes.AddRange(
                    new Perfume
                {
                    Name   = "Eclat d’Arpege",
                    Price  = 1500,
                    Count  = 10,
                    Volume = 30,
                    Brand  = "Chanel"
                },
                    new Perfume
                {
                    Name   = "Coco Mademoiselle",
                    Price  = 6000,
                    Count  = 50,
                    Volume = 50,
                    Brand  = "Lanvin"
                },
                    new Perfume
                {
                    Name   = "Acqua di Gioia",
                    Price  = 4700,
                    Count  = 15,
                    Volume = 50,
                    Brand  = "Armani"
                },
                    new Perfume
                {
                    Name   = "Bright Crystal",
                    Price  = 4000,
                    Count  = 10,
                    Volume = 50,
                    Brand  = "Versace"
                },
                    new Perfume
                {
                    Name   = "Very Irresistible",
                    Price  = 4500,
                    Count  = 15,
                    Volume = 50,
                    Brand  = "Givenchy"
                },
                    new Perfume
                {
                    Name   = "Chance Eau Tendre",
                    Price  = 7400,
                    Count  = 15,
                    Volume = 50,
                    Brand  = "Chanel"
                },
                    new Perfume
                {
                    Name   = "Body Tender",
                    Price  = 2500,
                    Count  = 15,
                    Volume = 60,
                    Brand  = "Burberry"
                },
                    new Perfume
                {
                    Name   = "L'eau par",
                    Price  = 2400,
                    Count  = 15,
                    Volume = 50,
                    Brand  = "Kenzo"
                }
                    );
                context.SaveChanges();
            }
        }
示例#24
0
 public EfGetPerfumesQuery(PerfumeContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
示例#25
0
 // private readonly string _issuer;
 // private readonly string _secretKey;
 public JwtManager(PerfumeContext context)
 {
     _context = context;
     //  _issuer = issuer;
     // _secretKey = secretKey;
 }