示例#1
0
 public ListAnimalsQueryHandler(PetShopContext context)
 {
     _context = context;
 }
示例#2
0
        public static void SeedDB(PetShopContext ctx)
        {
            ctx.Database.EnsureDeleted();
            ctx.Database.EnsureCreated();

            var owner1 = ctx.Owners.Add(new Owner()
            {
                FirstName   = "Lotte",
                LastName    = "Tubæk",
                Address     = "Rosenparken 53",
                Email       = "*****@*****.**",
                PhoneNumber = "23313226"
            }
                                        ).Entity;

            var owner2 = ctx.Owners.Add(new Owner()
            {
                FirstName   = "Mikael",
                LastName    = "Fabrisous",
                Address     = "Gammelmandvej 53",
                Email       = "*****@*****.**",
                PhoneNumber = "2334334226"
            }
                                        ).Entity;


            var pet1 = ctx.Pets.Add(new Pet()
            {
                name          = "Daniel",
                type          = "Goat",
                color         = "Ugly",
                price         = 2400,
                previousOwner = owner1
            });

            var pet2 = ctx.Pets.Add(new Pet()
            {
                name          = "Misser",
                type          = "Hund",
                color         = "Brun",
                price         = 7699,
                previousOwner = owner2
            });

            string password = "******";

            byte[] passwordHashJoe, passwordSaltJoe, passwordHashAnn, passwordSaltAnn;
            CreatePasswordHash(password, out passwordHashJoe, out passwordSaltJoe);
            CreatePasswordHash(password, out passwordHashAnn, out passwordSaltAnn);

            List <User> users = new List <User>
            {
                new User {
                    Username     = "******",
                    PasswordHash = passwordHashJoe,
                    PasswordSalt = passwordSaltJoe,
                    IsAdmin      = false
                },
                new User {
                    Username     = "******",
                    PasswordHash = passwordHashAnn,
                    PasswordSalt = passwordSaltAnn,
                    IsAdmin      = true
                }
            };

            ctx.Users.AddRange(users);
            ctx.SaveChanges();
        }
 public ColorRepository(PetShopContext ctx)
 {
     _ctx = ctx;
 }
示例#4
0
        static void Main()
        {
            PetShopContext context = new PetShopContext();

            context.SaveChanges();
        }
 public PrincipalController(PetShopContext context)
 {
     _context = context;
 }
示例#6
0
 public SopstveniksController(PetShopContext context, IHostingEnvironment hostEnvironment)
 {
     _context           = context;
     webHostEnvironment = hostEnvironment;
 }
示例#7
0
        public static void Seed(PetShopContext ctx)
        {
            Pet pet1 = new Pet
            {
                name          = "Rex",
                type          = PetTypes.Dog,
                birthDate     = new DateTime(2017, 4, 20),
                soldDate      = new DateTime(2017, 6, 25),
                color         = "Brownish",
                price         = 275,
                ownersHistory = new List <PetOwner>()
            };
            Pet pet2 = new Pet
            {
                name          = "Spoofy",
                type          = PetTypes.Cat,
                birthDate     = new DateTime(2018, 3, 10),
                soldDate      = new DateTime(2018, 3, 30),
                color         = "White and black",
                price         = 550,
                ownersHistory = new List <PetOwner>()
            };
            Owner owner1 = new Owner
            {
                firstName  = "Simon",
                lastName   = "Kjær",
                address    = "Stengårdsvej 12",
                petHistory = new List <PetOwner>()
            };
            Owner owner2 = new Owner
            {
                firstName  = "Levis",
                lastName   = "Kjongaard",
                address    = "Hjertingvej 5",
                petHistory = new List <PetOwner>()
            };



            owner1 = ctx.Owners.Add(owner1).Entity;
            owner2 = ctx.Owners.Add(owner2).Entity;

            PetOwner PetOwner1 = new PetOwner
            {
                Owner = owner1
            };

            PetOwner PetOwner2 = new PetOwner
            {
                Owner = owner2
            };

            PetOwner PetOwner3 = new PetOwner
            {
                Owner = owner1
            };

            pet1.ownersHistory.Add(PetOwner1);
            pet1.ownersHistory.Add(PetOwner2);
            pet2.ownersHistory.Add(PetOwner3);

            ctx.Pets.Add(pet1);
            ctx.Pets.Add(pet2);



            ctx.SaveChanges();
        }
示例#8
0
 public PetRepository(PetShopContext context)
 {
     _context = context;
 }
 public ShoppingCartController(PetShopContext context)
 {
     _context = context;
 }
 public ListProductOrdersQueryHandler(PetShopContext context)
 {
     _context = context;
 }
示例#11
0
 public Repository(IConfiguration configuration, PetShopContext petShop)
 {
     AnimalsPerPage = configuration.GetValue("AnimalsPerPage", 6);
     this.petShop   = petShop;
 }
示例#12
0
 public AccessoryCategoryController(PetShopContext context)
 {
     _context = context;
 }
示例#13
0
 public CompanyRepository(PetShopContext context)
 {
     _context = context;
 }
示例#14
0
 public CreateProductCommandHandler(PetShopContext context)
 {
     _context = context;
 }
 public GetProductByIdQueryHandler(PetShopContext context)
 {
     _context = context;
 }
示例#16
0
 public OwnerRepository(PetShopContext context)
 {
     _context = context;
 }
 public UpdateProductInfoCommandHandler(PetShopContext context)
 {
     _context = context;
 }
示例#18
0
 public FavoriteDAO(PetShopContext context)
 {
     _context = context;
 }
示例#19
0
 public TransactionController(PetShopContext context)
 {
     _context = context;
 }
示例#20
0
 public CreateCustomerCommandHandler(PetShopContext context)
 {
     _context = context;
 }
示例#21
0
 public ColorRepo(PetShopContext ctx)
 {
     this._ctx = ctx;
 }
示例#22
0
 public OwnerRepository(PetShopContext ctx)
 {
     _ctx = ctx;
 }
示例#23
0
 public UpdateCustomerInfoCommandHandler(PetShopContext context)
 {
     _context = context;
 }
示例#24
0
 public PetRepository(PetShopContext ctx)
 {
     _ctx = ctx;
 }
示例#25
0
 public OwnerRepo(PetShopContext ctx)
 {
     _ctx = ctx;
 }
示例#26
0
 public PetRepository(PetShopContext ctx, IOwnerService ownerService)
 {
     _ctx          = ctx;
     _ownerService = ownerService;
 }
示例#27
0
 public UserRepository(PetShopContext context)
 {
     db = context;
 }