Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.EntityFrameworkCore;
- using CarPooling.DAL.Entities;
- namespace CarPooling.BL.ProdSeeds
- {
- public static class ProdCUsersSeeds
- {
- public static readonly UserEntity Ivan = new(
- Id: Guid.Parse(input: "DF935095-8709-4040-A2BB-B6F97CB496DC"),
- Name: "Ivan",
- Role: "Driver",
- Surname: "Bobrov",
- UserImageUrl: @"https://png.pngitem.com/pimgs/s/575-5754610_bus-driver-png-bus-driver-images-cartoon-transparent.png"
- );
- public static readonly UserEntity Frantisek = new(
- Id: Guid.Parse(input: "DF935095-8709-4040-A2BB-B6F97CB496DC"),
- Name: "Frantisek",
- Role: "Driver",
- Surname: "Cerstvy",
- UserImageUrl: @"https://png.pngitem.com/pimgs/s/575-5754610_bus-driver-png-bus-driver-images-cartoon-transparent.png"
- );
- public static readonly UserEntity Krystof = new(
- Id: Guid.Parse(input: "DF935095-8709-4040-A2BB-B6F97CB496DC"),
- Name: "Krystof",
- Role: "User",
- Surname: "Dolezal",
- UserImageUrl: @"https://png.pngitem.com/pimgs/s/575-5754610_bus-driver-png-bus-driver-images-cartoon-transparent.png"
- );
- public static void ProdSeed(this ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<UserEntity>().HasData(Ivan);
- modelBuilder.Entity<UserEntity>().HasData(Frantisek);
- modelBuilder.Entity<UserEntity>().HasData(Krystof);
- }
- }
- }
- using System;
- using CarPooling.BL.ProdSeeds;
- using Microsoft.EntityFrameworkCore;
- using CarPooling.DAL.Entities;
- using CarPooling.DAL.Enums;
- using CarPooling.DAL.Seeds;
- namespace CarPooling.Bl.ProdSeeds
- {
- public static class ProdSeatsSeeds
- {
- public static readonly SeatEntity Seat1 = new(
- Id: Guid.Parse(input: "DF935095-8709-4040-7777-B6F97CB416DC"),
- UserEntityId: ProdCUsersSeeds.Krystof.Id,
- RideEntityId: ProdRidesSeeds.Ride1.Id
- )
- {
- UserEntity = ProdCUsersSeeds.Krystof,
- RideEntity = ProdRidesSeeds.Ride1
- };
- public static readonly SeatEntity Seat2 = new(
- Id: Guid.Parse(input: "DF935095-8709-4040-6677-B6F97CB416DC"),
- UserEntityId: ProdCUsersSeeds.Krystof.Id,
- RideEntityId: ProdRidesSeeds.Ride2.Id
- )
- {
- UserEntity = ProdCUsersSeeds.Krystof,
- RideEntity = ProdRidesSeeds.Ride2
- };
- public static void Seed(this ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<CarEntity>().HasData(Seat1);
- modelBuilder.Entity<CarEntity>().HasData(Seat2);
- }
- }
- }
- using System;
- using CarPooling.BL.ProdSeeds;
- using Microsoft.EntityFrameworkCore;
- using CarPooling.DAL.Entities;
- using CarPooling.DAL.Enums;
- namespace CarPooling.Bl.ProdSeeds
- {
- public static class ProdRidesSeeds
- {
- public static readonly RideEntity Ride1 = new(
- Id: Guid.Parse(input: "9D2B0228-4D0D-8888-8B49-01A698857709"),
- BeginCityId: ProdCitiesSeeds.Brno.Id,
- EndCityId: ProdCitiesSeeds.Praha.Id,
- BeginTime: new DateTime(2022, 5, 17, 20, 0, 0),
- EndTime: new DateTime(2022, 6, 18, 23, 30, 0),
- Description: "2 mista pro deti, zadne zavazadlo",
- Price: 5,
- EmptySeats: 1,
- UserEntityId: ProdCUsersSeeds.Ivan.Id,
- CarEntityId: ProdCarSeed.Chevrolet.Id)
- {
- BeginCity = ProdCitiesSeeds.Brno,
- EndCity = ProdCitiesSeeds.Praha,
- UserEntity = ProdCUsersSeeds.Ivan,
- CarEntity = ProdCarSeed.Chevrolet
- };
- public static readonly RideEntity Ride2 = new(
- Id: Guid.Parse(input: "11210228-4D0D-9999-8B49-01A69885A09A"),
- BeginCityId: ProdCitiesSeeds.Olomouc.Id,
- EndCityId: ProdCitiesSeeds.Zlicin.Id,
- BeginTime: new DateTime(2022, 5, 17, 20, 0, 0),
- EndTime: new DateTime(2022, 5, 17, 23, 30, 0),
- Description: "Zadne zavazadlo",
- Price: 10,
- EmptySeats: 1,
- UserEntityId: ProdCUsersSeeds.Frantisek.Id,
- CarEntityId: ProdCarSeed.Skoda.Id)
- {
- BeginCity = ProdCitiesSeeds.Olomouc,
- EndCity = ProdCitiesSeeds.Zlicin,
- UserEntity = ProdCUsersSeeds.Frantisek,
- CarEntity = ProdCarSeed.Skoda
- };
- public static void ProdSeed(this ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<CarEntity>().HasData(Ride1);
- modelBuilder.Entity<CarEntity>().HasData(Ride2);
- }
- }
- }
- using System;
- using Microsoft.EntityFrameworkCore;
- using CarPooling.DAL.Entities;
- namespace CarPooling.BL.ProdSeeds
- {
- public static class ProdCitiesSeeds
- {
- public static readonly CityEntity Praha = new(
- Id: Guid.Parse(input: "06A8A2CF-EA03-0000-A3E4-AA0291FE9C75"),
- CityName: "Praha"
- );
- public static readonly CityEntity Brno = new(
- Id: Guid.Parse(input: "7777A2CF-EA03-1111-A3E4-AA0291FE86A1"),
- CityName: "Brno"
- );
- public static readonly CityEntity Olomouc = new(
- Id: Guid.Parse(input: "06A8A2CF-EA03-2222-A3E4-AA0291FE9C75"),
- CityName: "Olomouc"
- );
- public static readonly CityEntity Zlicin = new(
- Id: Guid.Parse(input: "7777A2CF-EA03-3333-A3E4-AA0291FE86A1"),
- CityName: "Zlicin"
- );
- public static void ProdSeed(this ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<CityEntity>().HasData(
- Praha
- );
- modelBuilder.Entity<CityEntity>().HasData(
- Brno
- );
- modelBuilder.Entity<CityEntity>().HasData(
- Olomouc
- );
- modelBuilder.Entity<CityEntity>().HasData(
- Zlicin
- );
- }
- }
- }
- using System;
- using Microsoft.EntityFrameworkCore;
- using CarPooling.DAL.Entities;
- using CarPooling.DAL.Enums;
- using CarPooling.DAL.Seeds;
- namespace CarPooling.BL.ProdSeeds
- {
- public static class ProdCarSeed
- {
- public static readonly CarEntity Mazda = new(
- Id: Guid.Parse(input: "9D2B0228-4D0D-0000-8B49-01A698857711"),
- Model: "Mazda-MX5",
- LicensePlate: "4A23000",
- Type: CarType.Sports_car,
- CarImageUrl:
- @"https://png.pngitem.com/pimgs/s/138-1387238_land-vehicle-muscle-car-hardtop-chevrolet-chevelle-full.png",
- NSeats: 1,
- RegistrationDate: new DateTime(2022, 5, 10),
- UserEntityId: ProdCUsersSeeds.Frantisek.Id
- )
- {
- UserEntity = ProdCUsersSeeds.Frantisek
- };
- public static readonly CarEntity Skoda = new(
- Id: Guid.Parse(input: "9D2B0228-4D0D-1111-8B49-01A698857711"),
- Model: "Skoda-Rapid",
- LicensePlate: "0A23000",
- Type: CarType.Sedan,
- CarImageUrl:
- @"https://png.pngitem.com/pimgs/s/138-1387238_land-vehicle-muscle-car-hardtop-chevrolet-chevelle-full.png",
- NSeats: 5,
- RegistrationDate: new DateTime(2022, 4, 17),
- UserEntityId: ProdCUsersSeeds.Frantisek.Id
- )
- {
- UserEntity = ProdCUsersSeeds.Frantisek
- };
- public static readonly CarEntity Chevrolet = new(
- Id: Guid.Parse(input: "9D2B0228-4D0D-2222-8B49-01A698857711"),
- Model: "Chevrolet-Сhevelle",
- LicensePlate: "1A23000",
- Type: CarType.Sedan,
- CarImageUrl:
- @"https://png.pngitem.com/pimgs/s/138-1387238_land-vehicle-muscle-car-hardtop-chevrolet-chevelle-full.png",
- NSeats: 5,
- RegistrationDate: new DateTime(2022, 8, 17),
- UserEntityId: ProdCUsersSeeds.Ivan.Id
- )
- {
- UserEntity = ProdCUsersSeeds.Ivan
- };
- public static void ProdSeed(this ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<CarEntity>().HasData(Chevrolet);
- modelBuilder.Entity<CarEntity>().HasData(Mazda);
- modelBuilder.Entity<CarEntity>().HasData(Skoda);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement