Exemple #1
0
        public void INitData()
        {
            var pet1 = _petRepository.CreatePet(new Pet()
            {
                Name          = "Mickey",
                Color         = "red",
                Race          = "Cat",
                PreviousOwner = "Bob Dylan",
                Price         = 100,
            });


            var pet2 = _petRepository.CreatePet(new Pet()
            {
                Name          = "Peter",
                Color         = "Black",
                Race          = "Dog",
                PreviousOwner = "Man Dylan",
                Price         = 150,
            });
            var owner1 = _previousOwnerRepository.CreateOwner(new Owner()
            {
                Name = "Ceasar Melan",
                Race = "Human",
            });
            var petType1 = _petTypeRepository.CreatePetType(new PetType()
            {
                Name = "Doggo",
                Race = "Dog"
            });
        }
        public PetType CreatePetType(PetType type)
        {
            PetType petTypeAdd;

            if (type == null)
            {
                throw new InvalidDataException("missing pet type to add");
            }
            else if (type.PetTypeName.Length < 1)
            {
                throw new InvalidDataException("pet type name is to short");
            }

            petTypeAdd = _petTypeRepository.CreatePetType(type);
            if (petTypeAdd == null)
            {
                throw new DataException("could not add pet type");
            }

            return(petTypeAdd);
        }
Exemple #3
0
 public PetType CreatePetType(PetType newPetType)
 {
     return(_petTypeRepo.CreatePetType(newPetType));
 }
 public PetType CreateType(PetType petType)
 {
     return(_typeRepo.CreatePetType(petType));
 }
Exemple #5
0
 public PetType CreatePetType(PetType petType)
 {
     return(_petTypeRepository.CreatePetType(petType));
 }
        public void InitData()
        {
            var pet1 = new Pet()
            {
                Name = "Billy",
                Type = new PetType()
                {
                    Id = 1
                },
                BirthDate     = DateTime.Now.AddYears(-2),
                Color         = "White",
                PreviousOwner = "Joe",
                Price         = 500,
                SoldDate      = DateTime.Now.AddYears(-2),
                Owner         = new Owner()
                {
                    Id = 1
                }
            };

            _petRepo.CreatePet(pet1);

            var pet2 = new Pet()
            {
                Name = "Bob",
                Type = new PetType()
                {
                    Id = 2
                },
                BirthDate     = DateTime.Now.AddYears(-3),
                Color         = "Black",
                PreviousOwner = "Michael",
                Price         = 100,
                SoldDate      = DateTime.Now.AddYears(-1),
                Owner         = new Owner()
                {
                    Id = 2
                }
            };

            _petRepo.CreatePet(pet2);


            var pet3 = new Pet()
            {
                Name = "Joe",
                Type = new PetType()
                {
                    Id = 3
                },
                BirthDate     = DateTime.Now.AddYears(-10),
                Color         = "Orange",
                PreviousOwner = "Tommy",
                Price         = 1500,
                SoldDate      = DateTime.Now.AddYears(-2),
                Owner         = new Owner()
                {
                    Id = 2
                }
            };

            _petRepo.CreatePet(pet3);


            var pet4 = new Pet()
            {
                Name = "Timmy",
                Type = new PetType()
                {
                    Id = 1
                },
                BirthDate     = DateTime.Now.AddYears(-2),
                Color         = "Brown",
                PreviousOwner = "Dimitri",
                Price         = 1250,
                SoldDate      = DateTime.Now.AddYears(-1),
                Owner         = new Owner()
                {
                    Id = 2
                }
            };

            _petRepo.CreatePet(pet4);


            var pet5 = new Pet()
            {
                Name = "Splinter",
                Type = new PetType()
                {
                    Id = 2
                },
                BirthDate     = DateTime.Now.AddYears(-3),
                Color         = "Grey",
                PreviousOwner = "Michael",
                Price         = 50,
                SoldDate      = DateTime.Now.AddYears(-1),
                Owner         = new Owner()
                {
                    Id = 1
                }
            };

            _petRepo.CreatePet(pet5);

            var pet6 = new Pet()
            {
                Name = "Mujo",
                Type = new PetType()
                {
                    Id = 3
                },
                BirthDate     = DateTime.Now.AddYears(-2),
                Color         = "Yellow",
                PreviousOwner = "Betty",
                Price         = 145,
                SoldDate      = DateTime.Now.AddYears(-1),
                Owner         = new Owner()
                {
                    Id = 2
                }
            };

            _petRepo.CreatePet(pet6);


            var owner1 = new Owner()
            {
                FirstName   = "Bob",
                LastName    = "Bobsen",
                Address     = "Storegade 1",
                PhoneNumber = 12345678,
            };

            _ownerRepo.CreateOwner(owner1);

            var owner2 = new Owner()
            {
                FirstName   = "Joe",
                LastName    = "Cool",
                Address     = "Langevej 1",
                PhoneNumber = 22345678
            };

            _ownerRepo.CreateOwner(owner2);

            var type1 = new PetType()
            {
                Type = "Dog"
            };

            _typeRepo.CreatePetType(type1);

            var type2 = new PetType()
            {
                Type = "Cat"
            };

            _typeRepo.CreatePetType(type2);

            var type3 = new PetType()
            {
                Type = "Bird"
            };

            _typeRepo.CreatePetType(type3);
        }
 public PetType CreatePetType(PetType createdPetType)
 {
     return(_petTypeRepo.CreatePetType(createdPetType));
 }
 public PetType CreatePetType(PetType petTypeToCreate)
 {
     var validatedPetType = ValidatePetType(petTypeToCreate, false);
     return _petTypeRepository.CreatePetType(validatedPetType);
 }
Exemple #9
0
        public void InitData()
        {
            // OWNERS
            Owner owner1 = new Owner()
            {
                Name      = "Cobber McCorker",
                Address   = "30 Happy Pet Lane",
                PetsOwned = null // new Pet() {PetId = 11})
            };

            _ownerRepo.CreateOwner(owner1);


            Owner owner2 = new Owner()
            {
                Name      = "Daevid Allen",
                Address   = "Planet Gong",
                PetsOwned = null
            };

            _ownerRepo.CreateOwner(owner2);


            Owner owner3 = new Owner()
            {
                Name      = "Jake Roberts",
                Address   = "12 Reptile Rd",
                PetsOwned = null
            };

            _ownerRepo.CreateOwner(owner3);


            Owner owner4 = new Owner()
            {
                Name      = "Ginger Buns",
                Address   = "43 Muffin Grove",
                PetsOwned = null
            };

            _ownerRepo.CreateOwner(owner4);


            Owner owner5 = new Owner()
            {
                Name      = "Marty MyFries",
                Address   = "1955 Future Path",
                PetsOwned = null
            };

            _ownerRepo.CreateOwner(owner5);


            Owner owner6 = new Owner()
            {
                Name      = "Henry Hippo",
                Address   = "90 Zoo Gardens",
                PetsOwned = null
            };

            _ownerRepo.CreateOwner(owner6);



            // PET TYPES
            PetType petType1 = new PetType()
            {
                Name = "Snake"
            };

            _petTypeRepo.CreatePetType(petType1);


            PetType petType2 = new PetType()
            {
                Name = "Cat"
            };

            _petTypeRepo.CreatePetType(petType2);


            PetType petType3 = new PetType()
            {
                Name = "Dog"
            };

            _petTypeRepo.CreatePetType(petType3);


            PetType petType4 = new PetType()
            {
                Name = "Wombat"
            };

            _petTypeRepo.CreatePetType(petType4);


            PetType petType5 = new PetType()
            {
                Name = "Fish"
            };

            _petTypeRepo.CreatePetType(petType5);


            PetType petType6 = new PetType()
            {
                Name = "Iguana"
            };

            _petTypeRepo.CreatePetType(petType6);


            PetType petType7 = new PetType()
            {
                Name = "Frog"
            };

            _petTypeRepo.CreatePetType(petType7);


            PetType petType8 = new PetType()
            {
                Name = "Rabbit"
            };

            _petTypeRepo.CreatePetType(petType8);


            PetType petType9 = new PetType()
            {
                Name = "Giraffe"
            };

            _petTypeRepo.CreatePetType(petType9);


            PetType petType10 = new PetType()
            {
                Name = "Spider"
                       //SubType = "Black Widow"
            };

            _petTypeRepo.CreatePetType(petType10);



            // PETS
            Pet pet1 = new Pet()
            {
                Name = "Geoff",
                Type = petType1,
                //       Gender = Convert.ToChar("F"),
                BirthDate     = Convert.ToDateTime("1992-12-15"),
                SoldDate      = Convert.ToDateTime("2019-11-15"),
                Colour        = "Red",
                PreviousOwner = owner3,
                Price         = 330
            };

            _petRepo.CreatePet(pet1);


            Pet pet2 = new Pet()
            {
                Name = "Leo Long",
                Type = petType6,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("1920-12-14"),
                SoldDate      = Convert.ToDateTime("2012-11-15"),
                Colour        = "Blue",
                PreviousOwner = owner1,
                Price         = 1250
            };

            _petRepo.CreatePet(pet2);


            Pet pet3 = new Pet()
            {
                Name = "Freddy",
                Type = petType7,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("1930-12-14"),
                SoldDate      = Convert.ToDateTime("2013-11-15"),
                Colour        = "Orange",
                PreviousOwner = owner6,
                Price         = 56
            };

            _petRepo.CreatePet(pet3);


            Pet pet4 = new Pet()
            {
                Name = "Jake",
                Type = petType1,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("1940-12-14"),
                SoldDate      = Convert.ToDateTime("2014-11-15"),
                Colour        = "White",
                PreviousOwner = owner3,
                Price         = 343
            };

            _petRepo.CreatePet(pet4);


            Pet pet5 = new Pet()
            {
                Name = "Jeremy",
                Type = petType2,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("2010-12-14"),
                SoldDate      = Convert.ToDateTime("2017-11-15"),
                Colour        = "Blue",
                PreviousOwner = owner5,
                Price         = 238
            };

            _petRepo.CreatePet(pet5);


            Pet pet6 = new Pet()
            {
                Name = "Albert",
                Type = petType3,
                //       Gender = Convert.ToChar("F"),
                BirthDate     = Convert.ToDateTime("1992-12-15"),
                SoldDate      = Convert.ToDateTime("2019-11-15"),
                Colour        = "Black",
                PreviousOwner = owner2,
                Price         = 330
            };

            _petRepo.CreatePet(pet6);


            Pet pet7 = new Pet()
            {
                Name = " Richard",
                Type = petType1,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("2018-01-14"),
                SoldDate      = Convert.ToDateTime("2019-11-15"),
                Colour        = "Tan",
                PreviousOwner = owner5,
                Price         = 165
            };

            _petRepo.CreatePet(pet7);


            Pet pet8 = new Pet()
            {
                Name = "Zues",
                Type = petType9,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("2020-08-14"),
                SoldDate      = Convert.ToDateTime("2020-08-15"),
                Colour        = "Blue",
                PreviousOwner = owner2,
                Price         = 50
            };

            _petRepo.CreatePet(pet8);


            Pet pet9 = new Pet()
            {
                Name = "Stan",
                Type = petType9,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("2019-10-14"),
                SoldDate      = Convert.ToDateTime("2019-11-15"),
                Colour        = "White",
                PreviousOwner = owner5,
                Price         = 150
            };

            _petRepo.CreatePet(pet9);


            Pet pet10 = new Pet()
            {
                Name = "Selene",
                Type = petType5,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("2017-12-14"),
                SoldDate      = Convert.ToDateTime("2018-11-15"),
                Colour        = "Blue and Yellow",
                PreviousOwner = owner1,
                Price         = 970
            };

            _petRepo.CreatePet(pet10);


            Pet pet11 = new Pet()
            {
                Name = "Wally",
                Type = petType4,
                //      Gender = Convert.ToChar("M"),
                BirthDate     = Convert.ToDateTime("2016-06-04"),
                SoldDate      = Convert.ToDateTime("2018-01-06"),
                Colour        = "Brown",
                PreviousOwner = owner1,
                Price         = 450
            };

            _petRepo.CreatePet(pet11);
        }
        public void InitData()
        {
            Owner owner1 = _ownerRepository.CreateOwner(new Owner()
            {
                FirstName   = "John",
                LastName    = "Johnson",
                Address     = "Mock Street 1",
                PhoneNumber = "000000000",
                Email       = "*****@*****.**"
            });

            Owner owner2 = _ownerRepository.CreateOwner(new Owner()
            {
                FirstName   = "Jack",
                LastName    = "Jackson",
                Address     = "Mock Street 2",
                PhoneNumber = "000000000",
                Email       = "*****@*****.**"
            });

            Owner owner3 = _ownerRepository.CreateOwner(new Owner()
            {
                FirstName   = "Uncle",
                LastName    = "Bob",
                Address     = "Mock Street 3",
                PhoneNumber = "000000000",
                Email       = "*****@*****.**"
            });

            Owner owner4 = _ownerRepository.CreateOwner(new Owner()
            {
                FirstName   = "Martin",
                LastName    = "Fowler",
                Address     = "Mock Street 4",
                PhoneNumber = "000000000",
                Email       = "*****@*****.**"
            });

            Owner owner5 = _ownerRepository.CreateOwner(new Owner()
            {
                FirstName   = "Kent",
                LastName    = "Beck",
                Address     = "Mock Street 5",
                PhoneNumber = "000000000",
                Email       = "*****@*****.**"
            });

            Owner owner6 = _ownerRepository.CreateOwner(new Owner()
            {
                FirstName   = "Charles",
                LastName    = "Darwin",
                Address     = "Mock Street 6",
                PhoneNumber = "000000000",
                Email       = "*****@*****.**"
            });

            PetType dog = _petTypeRepository.CreatePetType(new PetType()
            {
                Species = "Dog"
            });

            PetType cat = _petTypeRepository.CreatePetType(new PetType()
            {
                Species = "Cat"
            });

            PetType parrot = _petTypeRepository.CreatePetType(new PetType()
            {
                Species = "Parrot"
            });

            PetType rabbit = _petTypeRepository.CreatePetType(new PetType()
            {
                Species = "Rabbit"
            });

            PetType turtle = _petTypeRepository.CreatePetType(new PetType()
            {
                Species = "Turtle"
            });


            _petRepository.CreatePet(new Pet()
            {
                Name          = "Snoopy",
                Type          = dog,
                BirthDate     = DateTime.Parse("01-01-2020", new CultureInfo("de-DE")),
                SoldDate      = DateTime.Parse("01-06-2020", new CultureInfo("de-DE")),
                Color         = "White",
                PreviousOwner = owner1,
                Price         = 2500
            });

            _petRepository.CreatePet(new Pet()
            {
                Name          = "Garfield",
                Type          = cat,
                BirthDate     = DateTime.Parse("01-12-2019", new CultureInfo("de-DE")),
                SoldDate      = DateTime.Parse("01-05-2020", new CultureInfo("de-DE")),
                Color         = "Orange",
                PreviousOwner = owner2,
                Price         = 2000
            });

            _petRepository.CreatePet(new Pet()
            {
                Name          = "Clean Cat",
                Type          = cat,
                BirthDate     = DateTime.Parse("01-12-2010", new CultureInfo("de-DE")),
                SoldDate      = DateTime.Parse("01-05-2012", new CultureInfo("de-DE")),
                Color         = "White/red",
                PreviousOwner = owner3,
                Price         = 3000
            });

            _petRepository.CreatePet(new Pet()
            {
                Name          = "Fowl",
                Type          = parrot,
                BirthDate     = DateTime.Parse("01-12-2016", new CultureInfo("de-DE")),
                SoldDate      = DateTime.Parse("01-05-2017", new CultureInfo("de-DE")),
                Color         = "White",
                PreviousOwner = owner4,
                Price         = 5000
            });

            _petRepository.CreatePet(new Pet()
            {
                Name          = "Bugs Bunny",
                Type          = rabbit,
                BirthDate     = DateTime.Parse("01-12-2018", new CultureInfo("de-DE")),
                SoldDate      = DateTime.Parse("01-05-2019", new CultureInfo("de-DE")),
                Color         = "White/grey",
                PreviousOwner = owner5,
                Price         = 1500
            });

            _petRepository.CreatePet(new Pet()
            {
                Name          = "Aesop",
                Type          = turtle,
                BirthDate     = DateTime.Parse("15-09-1830", new CultureInfo("de-DE")),
                SoldDate      = DateTime.Parse("15-09-1835", new CultureInfo("de-DE")),
                Color         = "Green",
                PreviousOwner = owner6,
                Price         = 3500
            });
        }