Esempio n. 1
0
        private void CreateBtnClick(object sender, RoutedEventArgs e)
        {
            if (TypeComboBox.SelectedIndex != -1 &&
                BrandComboBox.SelectedIndex != -1 &&
                !String.IsNullOrWhiteSpace(YeartextBox.Text))
            {
                Brand brand = (Brand)BrandComboBox.SelectionBoxItem;

                BicycleType bType = (BicycleType)TypeComboBox.SelectionBoxItem;

                Wheel wheel = (Wheel)WheelComboBox.SelectionBoxItem;

                Frame frame = (Frame)FrameComboBox.SelectionBoxItem;

//                BikeService.CreateBicycle(YeartextBox.Text, brand.Id,
//                    bType.Id, wheel.Id, frame.Id, 1);

                Bicycle b = new Bicycle
                {
                    WheelSizeId = wheel.Id,
                    BrandId     = brand.Id,
                    FrameSizeId = frame.Id,
                    TypeId      = bType.Id,
                    Year        = YeartextBox.Text,
                    UserId      = BikenBike.CurrentUser.Id
                };

                BikeService.CreateBicycle(b);

                window.Content = new BicyclePage(window);
            }
        }
        /// <summary cref="IEncodeable.IsEqual(IEncodeable)" />
        public override bool IsEqual(IEncodeable encodeable)
        {
            if (Object.ReferenceEquals(this, encodeable))
            {
                return(true);
            }

            BicycleType value = encodeable as BicycleType;

            if (value == null)
            {
                return(false);
            }

            if (!base.IsEqual(encodeable))
            {
                return(false);
            }
            if (!Utils.IsEqual(m_noOfGears, value.m_noOfGears))
            {
                return(false);
            }
            if (!Utils.IsEqual(m_manufacterName, value.m_manufacterName))
            {
                return(false);
            }

            return(true);
        }
        public async Task <bool> DeleteType(BicycleType bicycleType)
        {
            dbContext.BicycleType.Remove(bicycleType);
            await dbContext.SaveChangesAsync();

            return(true);
        }
Esempio n. 4
0
        public string ParkBicycle(BicycleType type)
        {
            Bicycle bicycle = new Bicycle(type);

            allParkedBicycles.Add(bicycle);

            return(bicycle.GetTicketNr());
        }
        public async Task <bool> AddType(BicycleType value)
        {
            await dbContext.BicycleType.AddAsync(value);

            await dbContext.SaveChangesAsync();

            return(true);
        }
        /// <summary cref="Object.MemberwiseClone" />
        public new object MemberwiseClone()
        {
            BicycleType clone = (BicycleType)base.MemberwiseClone();

            clone.m_noOfGears      = (uint)Utils.Clone(this.m_noOfGears);
            clone.m_manufacterName = (QualifiedName)Utils.Clone(this.m_manufacterName);

            return(clone);
        }
Esempio n. 7
0
        // Constructor

        public Bicycle(BicycleType type)
        {
            this.Type        = type;
            this.IsInParking = true;

            string t = this.Type.ToString();

            this.ticketNumber = $"{t.Substring(0, 3)}{Bicycle.ticketSeeder}";

            Bicycle.ticketSeeder++;
        }
Esempio n. 8
0
        public static void Seed(this ModelBuilder modelBuilder)
        {
            BicycleType road = new BicycleType {
                Id = Guid.NewGuid(), Name = "Road"
            };
            BicycleType city = new BicycleType {
                Id = Guid.NewGuid(), Name = "City"
            };
            BicycleType hybrid = new BicycleType {
                Id = Guid.NewGuid(), Name = "Hybrid"
            };
            BicycleType mountain = new BicycleType {
                Id = Guid.NewGuid(), Name = "Mountain"
            };

            Bicycle ardisSantana = new Bicycle {
                Id = Guid.NewGuid(), Name = "Ardis Santana", Price = 10.99, TypeId = city.Id, RentalStatus = true
            };
            Bicycle orbeaVector = new Bicycle {
                Id = Guid.NewGuid(), Name = "Orbea Vector", Price = 15.99, TypeId = city.Id, RentalStatus = true
            };
            Bicycle crossrideShark = new Bicycle {
                Id = Guid.NewGuid(), Name = "Crossride Shark", Price = 10.99, TypeId = mountain.Id, RentalStatus = true
            };
            Bicycle ghostTacana = new Bicycle {
                Id = Guid.NewGuid(), Name = "Ghost Tacana", Price = 8.50, TypeId = mountain.Id, RentalStatus = true
            };
            Bicycle corradoNamito = new Bicycle {
                Id = Guid.NewGuid(), Name = "Corrado Namitoa", Price = 13.50, TypeId = mountain.Id, RentalStatus = true
            };
            Bicycle ventoMonte = new Bicycle {
                Id = Guid.NewGuid(), Name = "Vento Monte", Price = 9.50, TypeId = mountain.Id, RentalStatus = true
            };
            Bicycle bergamontHelix = new Bicycle {
                Id = Guid.NewGuid(), Name = "Bergamont Helix", Price = 10.50, TypeId = hybrid.Id, RentalStatus = true
            };
            Bicycle authorCompact = new Bicycle {
                Id = Guid.NewGuid(), Name = "Author Compact", Price = 10.99, TypeId = hybrid.Id, RentalStatus = true
            };
            Bicycle trinxTempo = new Bicycle {
                Id = Guid.NewGuid(), Name = "TRINX Tempo", Price = 9.99, TypeId = road.Id, RentalStatus = true
            };
            Bicycle orbeaAvant = new Bicycle {
                Id = Guid.NewGuid(), Name = "Orbea Avant", Price = 14.50, TypeId = road.Id, RentalStatus = true
            };
            Bicycle bergamontPrime = new Bicycle {
                Id = Guid.NewGuid(), Name = "Bergamont PRIME", Price = 16.99, TypeId = road.Id, RentalStatus = true
            };

            modelBuilder.Entity <BicycleType>().HasData(road, city, hybrid, mountain);
            modelBuilder.Entity <Bicycle>().HasData(ardisSantana, orbeaVector, crossrideShark, ghostTacana, corradoNamito, ventoMonte, bergamontHelix, authorCompact, trinxTempo, orbeaAvant, bergamontPrime);
        }
Esempio n. 9
0
        public async Task <bool> Add(BicycleType bicycleType)
        {
            var result = _bicycleTypeRepository.GetType(bicycleType.Name);

            if (result != null)
            {
                throw new DuplicateElement("Element with same name is already there");
            }
            try
            {
                await _bicycleTypeRepository.AddType(bicycleType);

                return(true);
            }
            catch (Exception exp)
            {
                throw new BicycleTypeException("Cannot add new type" + exp.Message);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Возвращает количество взятий в прокат велосипедов выбранного типа.
        /// </summary>
        public static int GetRentsCount(BicycleType type)
        {
            var lcs  = LoadingCustomizationStruct.GetSimpleStruct(typeof(RentSession), RentSession.Views.RentSessionE);
            var ld   = SQLWhereLanguageDef.LanguageDef;
            var func = ld.GetFunction(
                ld.funcEQ,
                new VariableDef(
                    ld.StringType,
                    Information.ExtractPropertyPath <RentSession>(item => item.Bicycle.Type)
                    ),
                EnumCaption.GetCaptionFor(type)
                );

            lcs.LimitFunction = func;
            var ds = (SQLDataService)DataServiceProvider.DataService;

            return(ds.LoadObjects(lcs).Length);

            //return ds.Query<RentSession>(RentSession.Views.RentSessionE.Name)
            //    .Count(item => item.Bicycle.Type.Equals(type));
        }
Esempio n. 11
0
        public void setup()
        {
            bookingDB       = new BookingDB();
            advertisementDB = new AdvertisementDB();
            userDB          = new UserDB();
            bicycleDB       = new BicycleDB();
            crypto          = new CryptoModule();

            // Seed Brands
            b1 = new Brand {
                Name = "Croissant"
            };
            b2 = new Brand {
                Name = "Canondale"
            };
            b3 = new Brand {
                Name = "Trek"
            };

            // Seed Types
            bt1 = new BicycleType {
                TypeName = "Mountainbike"
            };
            bt2 = new BicycleType {
                TypeName = "Racer"
            };

            // Seed FrameSizes
            f1 = new Frame {
                Size = 30
            };
            f2 = new Frame {
                Size = 32
            };
            f3 = new Frame {
                Size = 34
            };
            f4 = new Frame {
                Size = 36
            };

            // Seed WheelSizes
            w1 = new Wheel {
                Size = 20
            };
            w2 = new Wheel {
                Size = 22
            };
            w3 = new Wheel {
                Size = 24
            };
            w4 = new Wheel {
                Size = 26
            };

            // Seed Users

            u1 = new User
            {
                Address = "test",
                Age     = "1",
                Salt    = crypto.GenerateSaltString(),
                Email   = "test",
                Name    = "test",
                PWord   = "1",
                Phone   = "1234",
                Zipcode = "9200"
            };

            u2 = new User
            {
                Address = "Hobrovej",
                Age     = "30",
                Salt    = crypto.GenerateSaltString(),
                Email   = "*****@*****.**",
                Name    = "John",
                PWord   = "123",
                Phone   = "87654321",
                Zipcode = "9000"
            };

            // Seed bicycles

            bike1 = new Bicycle
            {
                Brand     = b1,
                FrameSize = f1,
                Type      = bt1,
                User      = u1,
                WheelSize = w1,
                Year      = "2017"
            };

            bike2 = new Bicycle
            {
                Brand     = b2,
                FrameSize = f2,
                Type      = bt2,
                User      = u1,
                WheelSize = w2,
                Year      = "2016"
            };

            bike3 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f3,
                Type      = bt1,
                User      = u1,
                WheelSize = w3,
                Year      = "2015"
            };

            bike4 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f1,
                Type      = bt1,
                User      = u2,
                WheelSize = w1,
                Year      = "2012"
            };

            bike5 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f3,
                Type      = bt1,
                User      = u2,
                WheelSize = w3,
                Year      = "2011"
            };

            bike6 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f4,
                Type      = bt1,
                User      = u2,
                WheelSize = w4,
                Year      = "2010"
            };

            // Seed advertisements

            a1 = new Advertisement
            {
                Title       = "lorem 2",
                Description = "K0WJZFWWZW VLL4262TZI 81CS84SUUR OCWPGNS3X2 66WJ5APZLR BDCHCU3WEC",
                Price       = 18.90,
                StartDate   = DateTime.ParseExact("01/05/2017", "dd/MM/yyyy", null),
                EndDate     = DateTime.ParseExact("01/07/2017", "dd/MM/yyyy", null),
                User        = u2,
                Bike        = bike4
            };

            a2 = new Advertisement
            {
                Title       = "lorem 1",
                Description = "K0WJZFWWZW VLL4262TZI 81CS84SUUR OCWPGNS3X2 66WJ5APZLR BDCHCU3WEC",
                Price       = 18.90,
                StartDate   = DateTime.ParseExact("01/05/2017", "dd/MM/yyyy", null),
                EndDate     = DateTime.ParseExact("01/07/2017", "dd/MM/yyyy", null),
                User        = u1,
                Bike        = bike2
            };
        }
Esempio n. 12
0
        public void SeedDatabase(UserManager <LoginAccount> userManager)
        {
            var bType1 = new BicycleType {
                BikeTypeId = Guid.NewGuid(), Type = "Road Bike"
            };
            var bType2 = new BicycleType {
                BikeTypeId = Guid.NewGuid(), Type = "Mountain Bike"
            };
            var bType3 = new BicycleType {
                BikeTypeId = Guid.NewGuid(), Type = "Folding Bike"
            };
            var bType4 = new BicycleType {
                BikeTypeId = Guid.NewGuid(), Type = "Electric Bike"
            };

            var bike1 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Cannondale", ModelNo = "Slate Force 1", Status = "Available", BicycleType = bType1
            };
            var bike2 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Cannondale", ModelNo = "Slate Apex 1", Status = "Rented", BicycleType = bType1
            };
            var bike3 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Cannondale", ModelNo = "Topstone Apex 1", Status = "Available", BicycleType = bType1
            };
            var bike4 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Cannondale", ModelNo = "Topstone Sora", Status = "Available", BicycleType = bType1
            };
            var bike5 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Specialized", ModelNo = "Stumpjumper", Status = "Available", BicycleType = bType2
            };
            var bike6 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Specialized", ModelNo = "Stumpjumper Evo", Status = "Available", BicycleType = bType2
            };
            var bike7 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Specialized", ModelNo = "Enduro", Status = "Available", BicycleType = bType2
            };
            var bike8 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Specialized", ModelNo = "Fuse", Status = "Available", BicycleType = bType2
            };
            var bike9 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Dahon", ModelNo = "Mariner D8", Status = "Available", BicycleType = bType3
            };
            var bike10 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Dahon", ModelNo = "Launch D8", Status = "Available", BicycleType = bType3
            };
            var bike11 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Dahon", ModelNo = "Suv D6", Status = "Available", BicycleType = bType3
            };
            var bike12 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Dahon", ModelNo = "Piazza D7", Status = "Available", BicycleType = bType3
            };
            var bike13 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Pinarello", ModelNo = "Dust 3", Status = "Available", BicycleType = bType4
            };
            var bike14 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Pinarello", ModelNo = "Dust 2", Status = "Available", BicycleType = bType4
            };
            var bike15 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Pinarello", ModelNo = "Nytro", Status = "Available", BicycleType = bType4
            };
            var bike16 = new BicycleInventory {
                BikeId = Guid.NewGuid(), Brand = "Pinarello", ModelNo = "Nytro Roadstar", Status = "Available", BicycleType = bType4
            };

            var customer1 = new Customer
            {
                FirstName = "Kim",
                LastName  = "Jong-Un",
                Address   = "North Korea",
                BirthDate = Convert.ToDateTime("1/8/1984"),
                Status    = "Active"
            };
            var customer2 = new Customer
            {
                FirstName = "Donald",
                LastName  = "Trump",
                Address   = "United States",
                BirthDate = Convert.ToDateTime("6/14/1946"),
                Status    = "InActive"
            };
            var customer3 = new Customer
            {
                FirstName = "Vladimir",
                LastName  = "Putin",
                Address   = "Russia",
                BirthDate = Convert.ToDateTime("10/7/1952"),
                Status    = "Active"
            };
            var customer4 = new Customer
            {
                FirstName = "Rodrigo",
                LastName  = "Duterte",
                Address   = "Philippines",
                BirthDate = Convert.ToDateTime("3/28/1945"),
                Status    = "Active"
            };

            if (_context.Database.GetMigrations().Count() > 0 &&
                _context.Database.GetPendingMigrations().Count() == 0 &&
                _context.BicycleInventories.Count() == 0)
            {
                _context = _services.GetService <BicycleRentalDbContext>();

                _context.Add(bType1);
                _context.Add(bType2);
                _context.Add(bType3);
                _context.Add(bType4);

                _context.Add(bike1);
                _context.Add(bike2);
                _context.Add(bike3);
                _context.Add(bike4);
                _context.Add(bike5);
                _context.Add(bike6);
                _context.Add(bike7);
                _context.Add(bike8);
                _context.Add(bike9);
                _context.Add(bike10);
                _context.Add(bike11);
                _context.Add(bike12);
                _context.Add(bike13);
                _context.Add(bike14);
                _context.Add(bike15);
                _context.Add(bike16);

                _context.SaveChanges();
            }

            if (_context.Database.GetMigrations().Count() > 0 &&
                _context.Database.GetPendingMigrations().Count() == 0 &&
                _context.Customers.Count() == 0)
            {
                _context = _services.GetService <BicycleRentalDbContext>();

                _context.Add(customer1);
                _context.Add(customer2);
                _context.Add(customer3);
                _context.Add(customer4);

                _context.SaveChanges();
            }

            if (_context.Database.GetMigrations().Count() > 0 &&
                _context.Database.GetPendingMigrations().Count() == 0 &&
                _context.Roles.Count() == 0)
            {
                _context = _services.GetService <BicycleRentalDbContext>();

                var roles = new List <UserRole>()
                {
                    new UserRole {
                        Id = Guid.NewGuid(), Name = "Owner", NormalizedName = "OWNER"
                    },
                    new UserRole {
                        Id = Guid.NewGuid(), Name = "Staff", NormalizedName = "STAFF"
                    }
                };

                var logins = new List <LoginAccount>()
                {
                    new LoginAccount
                    {
                        Email              = "*****@*****.**",
                        EmailConfirmed     = true,
                        NormalizedEmail    = "*****@*****.**",
                        UserName           = "******",
                        NormalizedUserName = "******",
                        SecurityStamp      = Guid.NewGuid().ToString()
                    },
                    new LoginAccount
                    {
                        Email              = "*****@*****.**",
                        EmailConfirmed     = true,
                        NormalizedEmail    = "*****@*****.**",
                        UserName           = "******",
                        NormalizedUserName = "******",
                        SecurityStamp      = Guid.NewGuid().ToString()
                    }
                };

                var roleNames = new string[] { "Owner", "Staff" };

                for (int i = 0; i < roles.Count; i++)
                {
                    var roleStore = new RoleStore <UserRole, BicycleRentalDbContext, Guid>(_context);

                    roleStore.CreateAsync(roles[i]);
                }

                for (int i = 0; i < logins.Count; i++)
                {
                    var p = userManager.CreateAsync(logins[i], "Secret123-").Result;
                    var r = userManager.AddToRoleAsync(logins[i], roleNames[i]).Result;
                    Thread.Sleep(1000);
                    _context.SaveChanges();
                }
            }
        }
Esempio n. 13
0
 public async Task <bool> Post([FromBody] BicycleType value)
 {
     return(await this._bicycleTypeService.Add(value));
 }
Esempio n. 14
0
        public void setup()
        {
            _mockBookingDB = new Mock <IBookingDB>();                             // mocked database object
            _mockBookingDB.Setup(m => m.CreateBooking(It.IsAny <Booking>()));     // createBooking på mock tager imod enhver booking
            _bCtrl = new BookingCtrl(_mockBookingDB.Object);                      // injection af mock i vores bookingCtrl

            CryptoModule crypto = new CryptoModule();

            // Seed Brands
            b1 = new Brand {
                Name = "Croissant"
            };
            b2 = new Brand {
                Name = "Canondale"
            };
            b3 = new Brand {
                Name = "Trek"
            };

            // Seed Types
            bt1 = new BicycleType {
                TypeName = "Mountainbike"
            };
            bt2 = new BicycleType {
                TypeName = "Racer"
            };

            // Seed FrameSizes
            f1 = new Frame {
                Size = 30
            };
            f2 = new Frame {
                Size = 32
            };
            f3 = new Frame {
                Size = 34
            };
            f4 = new Frame {
                Size = 36
            };

            // Seed WheelSizes
            w1 = new Wheel {
                Size = 20
            };
            w2 = new Wheel {
                Size = 22
            };
            w3 = new Wheel {
                Size = 24
            };
            w4 = new Wheel {
                Size = 26
            };

            // Seed Users

            u1 = new User
            {
                Address = "Sofiendalsvej",
                Age     = "24",
                Salt    = crypto.GenerateSaltString(),
                Email   = "*****@*****.**",
                Name    = "Brian",
                PWord   = "123",
                Phone   = "12345678",
                Zipcode = "9200"
            };

            u2 = new User
            {
                Address = "Hobrovej",
                Age     = "30",
                Salt    = crypto.GenerateSaltString(),
                Email   = "*****@*****.**",
                Name    = "John",
                PWord   = "123",
                Phone   = "87654321",
                Zipcode = "9000"
            };

            // Seed bicycles

            bike1 = new Bicycle
            {
                Brand     = b1,
                FrameSize = f1,
                Type      = bt1,
                User      = u1,
                WheelSize = w1,
                Year      = "2017"
            };

            bike2 = new Bicycle
            {
                Brand     = b2,
                FrameSize = f2,
                Type      = bt2,
                User      = u1,
                WheelSize = w2,
                Year      = "2016"
            };

            bike3 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f3,
                Type      = bt1,
                User      = u1,
                WheelSize = w3,
                Year      = "2015"
            };

            bike4 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f1,
                Type      = bt1,
                User      = u2,
                WheelSize = w1,
                Year      = "2012"
            };

            bike5 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f3,
                Type      = bt1,
                User      = u2,
                WheelSize = w3,
                Year      = "2011"
            };

            bike6 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f4,
                Type      = bt1,
                User      = u2,
                WheelSize = w4,
                Year      = "2010"
            };

            // Seed advertisements

            a1 = new Advertisement
            {
                Title       = "lorem 2",
                Description = "K0WJZFWWZW VLL4262TZI 81CS84SUUR OCWPGNS3X2 66WJ5APZLR BDCHCU3WEC",
                Price       = 18.90,
                StartDate   = DateTime.ParseExact("01/05/2017", "dd/MM/yyyy", null),
                EndDate     = DateTime.ParseExact("01/07/2017", "dd/MM/yyyy", null),
                User        = u2,
                Bike        = bike4
            };

            a2 = new Advertisement
            {
                Title       = "lorem 1",
                Description = "K0WJZFWWZW VLL4262TZI 81CS84SUUR OCWPGNS3X2 66WJ5APZLR BDCHCU3WEC",
                Price       = 18.90,
                StartDate   = DateTime.ParseExact("01/05/2017", "dd/MM/yyyy", null),
                EndDate     = DateTime.ParseExact("01/07/2017", "dd/MM/yyyy", null),
                User        = u1,
                Bike        = bike2
            };
        }
Esempio n. 15
0
        protected override void Seed(Context context)
        {
            // Seed Brands
            Brand b1 = new Brand {
                Name = "Croissant"
            };
            Brand b2 = new Brand {
                Name = "Canondale"
            };
            Brand b3 = new Brand {
                Name = "Trek"
            };

            // Seed Types
            BicycleType bt1 = new BicycleType {
                TypeName = "Mountainbike"
            };
            BicycleType bt2 = new BicycleType {
                TypeName = "Racer"
            };

            // Seed FrameSizes
            Frame f1 = new Frame {
                Size = 30
            };
            Frame f2 = new Frame {
                Size = 32
            };
            Frame f3 = new Frame {
                Size = 34
            };
            Frame f4 = new Frame {
                Size = 36
            };

            // Seed WheelSizes
            Wheel w1 = new Wheel {
                Size = 20
            };
            Wheel w2 = new Wheel {
                Size = 22
            };
            Wheel w3 = new Wheel {
                Size = 24
            };
            Wheel w4 = new Wheel {
                Size = 26
            };

            // Seed Users

            var salt1 = crypto.GenerateSaltString();
            var salt2 = crypto.GenerateSaltString();

            User u1 = new User
            {
                Address = "Sofiendalsvej",
                Age     = "24",
                Salt    = salt2,
                Email   = "*****@*****.**",
                Name    = "Brian",
                PWord   = crypto.HashPassword("123", salt2),
                Phone   = "12345678",
                Zipcode = "9200"
            };

            User u2 = new User
            {
                Address = "Hobrovej",
                Age     = "30",
                Salt    = salt1,
                Email   = "*****@*****.**",
                Name    = "John",
                PWord   = crypto.HashPassword("123", salt1),
                Phone   = "87654321",
                Zipcode = "9000"
            };

            // Seed bicycles

            Bicycle bike1 = new Bicycle
            {
                Brand     = b1,
                FrameSize = f1,
                Type      = bt1,
                User      = u1,
                WheelSize = w1,
                Year      = "2017"
            };

            context.Bikes.Add(bike1);

            Bicycle bike2 = new Bicycle
            {
                Brand     = b2,
                FrameSize = f2,
                Type      = bt2,
                User      = u1,
                WheelSize = w2,
                Year      = "2016"
            };

            Bicycle bike3 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f3,
                Type      = bt1,
                User      = u1,
                WheelSize = w3,
                Year      = "2015"
            };

            context.Bikes.Add(bike3);

            Bicycle bike4 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f1,
                Type      = bt1,
                User      = u2,
                WheelSize = w1,
                Year      = "2012"
            };

            Bicycle bike5 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f3,
                Type      = bt1,
                User      = u2,
                WheelSize = w3,
                Year      = "2011"
            };

            context.Bikes.Add(bike5);

            Bicycle bike6 = new Bicycle
            {
                Brand     = b3,
                FrameSize = f4,
                Type      = bt1,
                User      = u2,
                WheelSize = w4,
                Year      = "2010"
            };

            context.Bikes.Add(bike6);

            // Seed advertisements

            context.Ads.Add(new Advertisement
            {
                Title       = "lorem 2",
                Description = "K0WJZFWWZW VLL4262TZI 81CS84SUUR OCWPGNS3X2 66WJ5APZLR BDCHCU3WEC",
                Price       = 18.90,
                StartDate   = DateTime.ParseExact("01/05/2017", "dd/MM/yyyy", null),
                EndDate     = DateTime.ParseExact("01/07/2017", "dd/MM/yyyy", null),
                User        = u2,
                Bike        = bike4
            });

            context.Ads.Add(new Advertisement
            {
                Title       = "lorem 1",
                Description = "K0WJZFWWZW VLL4262TZI 81CS84SUUR OCWPGNS3X2 66WJ5APZLR BDCHCU3WEC",
                Price       = 18.90,
                StartDate   = DateTime.ParseExact("01/05/2017", "dd/MM/yyyy", null),
                EndDate     = DateTime.ParseExact("01/07/2017", "dd/MM/yyyy", null),
                User        = u1,
                Bike        = bike2
            });
        }
Esempio n. 16
0
 public void UpdateBicycleBicycleType(BicycleType type)
 {
     BicycleType = type;
 }