public void InitData()
        {
            var petType = new PetType
            {
                Type = "Giraffe"
            };

            _petTypeRepository.Create(petType);
            PetTypes.Add(petType);

            var pet1 = new Pet
            {
                Name          = "Billy Joel",
                Type          = "Dog",
                Color         = "Golden",
                BirthDate     = new DateTime(2018, 6, 10),
                Price         = 100,
                SoldDate      = new DateTime(2018, 7, 10),
                PreviousOwner = "JohnnyBravo"
            };

            var owner1 = new Owner
            {
                Name    = "MichaelJackson",
                Address = "JohnnyBravo Street"
            };

            _petRepository.Create(pet1);
            _ownerRepository.Create(owner1);
        }
示例#2
0
        public void InitData()
        {
            var petType = new PetType
            {
                Type = "hund"
            };

            _petTypeRepository.Create(petType);
            PetTypes.Add(petType);

            var pet1 = new Pet
            {
                Name          = "hundenmads",
                Type          = "hund",
                Color         = "brun",
                BirthDate     = new DateTime(2019, 3, 10),
                Price         = 100,
                SoldDate      = new DateTime(2020, 2, 11),
                PreviousOwner = "mikkel"
            };

            var owner1 = new Owner
            {
                Name    = "frost",
                Address = "vinter"
            };

            _petRepository.Create(pet1);
            _ownerRepository.Create(owner1);
        }
示例#3
0
        public void InitData()
        {
            var petType = new PetType
            {
                Type = "dyr"
            };

            _petTypeRepository.Create(petType);
            PetTypes.Add(petType);

            var pet1 = new Pet
            {
                Name          = "job",
                Type          = "Dog",
                Color         = "Golden",
                BirthDate     = new DateTime(2018, 6, 10),
                Price         = 100,
                SoldDate      = new DateTime(2018, 7, 10),
                PreviousOwner = "mads"
            };

            var owner1 = new Owner
            {
                Name    = "hans",
                Address = "treet"
            };

            _petRepository.Create(pet1);
            _ownerRepository.Create(owner1);
        }
示例#4
0
        public void InitData()
        {
            var petType = new PetType
            {
                Type = "Golden Retriever"
            };

            var pet1 = new Pet
            {
                Name          = "Rex",
                Type          = "Golden Retriever",
                Color         = "Golden",
                BirthDate     = new DateTime(2018, 6, 10),
                Price         = 100,
                SoldDate      = new DateTime(2018, 7, 10),
                PreviousOwner = "FimFi"
            };

            var owner1 = new Owner
            {
                Name    = "FimFi",
                Address = "Skolegade 13"
            };

            _petTypeRepository.Create(petType);
            _petRepository.Create(pet1);
            _ownerRepository.Create(owner1);
        }
示例#5
0
 public bool Create(PetType model)
 {
     if (_petTypeValidationService.petTypeValidation(model))
     {
         return(_petTypeRepository.Create(model));
     }
     return(false);
 }
示例#6
0
 public PetType CreatePetType(PetType petType)
 {
     if (petType.Pet == null || petType.Pet.Id <= 0)
     {
         throw new InvalidDataException("To create pet type you need a pet");
     }
     if (_petRepo.ReadById(petType.Pet.Id) == null)
     {
         throw new InvalidDataException("Pet type not found");
     }
     return(_petTypeRepo.Create(petType));
 }
示例#7
0
        public void InitData(PetshopContext context)
        {
            string password = "******";

            byte[] passwordHashJoe, passwordSaltJoe, passwordHashAnn, passwordSaltAnn;
            authenticationHelper.CreatePasswordHash(password, out passwordHashJoe, out passwordSaltJoe);
            authenticationHelper.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
                }
            };
            var petType = new PetType
            {
                Type = "Golden Retriever"
            };

            var pet1 = new Pet
            {
                Name          = "Rex",
                Type          = "Golden Retriever",
                Color         = "Golden",
                BirthDate     = new DateTime(2018, 6, 10),
                Price         = 100,
                SoldDate      = new DateTime(2018, 7, 10),
                PreviousOwner = "owner1"
            };

            var owner1 = new Owner
            {
                Name    = "FimFi",
                Address = "Skolegade 13"
            };

            _petTypeRepository.Create(petType);
            _petRepository.Create(pet1);
            _ownerRepository.Create(owner1);
            context.Users.AddRange(users);
            context.SaveChanges();
        }
示例#8
0
        public void InitData()
        {
            var petType1 = new PetType()
            {
                Name = "Greyhound"
            };

            _petTypeRepo.Create(petType1);

            var pet1 = new Pet()
            {
                Name          = "Bob",
                Type          = "Dog",
                Birthdate     = new DateTime(2019, 05, 05),
                SoldDate      = new DateTime(2020, 05, 05),
                Color         = "Brown",
                PreviousOwner = "Some guy",
                Price         = 5000.00
            };

            _petRepo.Create(pet1);

            var pet2 = new Pet()
            {
                Name          = "Billy",
                Type          = "Cat",
                Birthdate     = new DateTime(2018, 05, 04),
                SoldDate      = new DateTime(2019, 04, 04),
                Color         = "Black",
                PreviousOwner = "Some other guy",
                Price         = 50.00
            };

            _petRepo.Create(pet2);

            var owner1 = new Owner()
            {
                Name    = "Michael",
                Address = "Billy Jean"
            };

            _ownerRepo.Create(owner1);
        }
示例#9
0
        public void InitData()
        {
            /*var address = new Address()
            {
                StreetName = "smurf"
            };
           address = _addressRepo.AddAddress(address);
*/

            var petType1 = new PetType
            {
                Type = "Doggos"
            };
            PetTypes.Add(petType1);

            var pet1 = new Pet
            {
                Name = "John",
                Type = "Dog", 
                BirthDate = new DateTime(2020, 10, 10),
                SoldDate = new DateTime(2020, 10, 10),
                Color = "green",
                PreviousOwner = "gert",
                Price = 434
            };
            Pets.Add(pet1);

            var owner1 = new Owner
            {
                Name = "tiltert",
                Address = "eart"
            };

            _ownerRepo.Create(owner1);
            _petTypeRepo.Create(petType1);
            _petRepo.Create(pet1);
        }
示例#10
0
 public PetType CreatePetType(PetType petType)
 {
     return(_petTypeRepo.Create(petType));
 }
示例#11
0
 /// <summary>
 /// Create a Type
 /// </summary>
 /// <param name="petType"></param>
 /// <returns></returns>
 public PetTypes CreateType(PetTypes petType)
 {
     return(_petTypeRepo.Create(petType));
 }