Advertisement
IvoB1n

seeds

May 14th, 2022
691
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using Microsoft.EntityFrameworkCore;
  3. using CarPooling.DAL.Entities;
  4.  
  5. namespace CarPooling.BL.ProdSeeds
  6. {
  7.     public static class ProdCUsersSeeds
  8.     {
  9.         public static readonly UserEntity Ivan = new(
  10.             Id: Guid.Parse(input: "DF935095-8709-4040-A2BB-B6F97CB496DC"),
  11.             Name: "Ivan",
  12.             Role: "Driver",
  13.             Surname: "Bobrov",
  14.             UserImageUrl: @"https://png.pngitem.com/pimgs/s/575-5754610_bus-driver-png-bus-driver-images-cartoon-transparent.png"
  15.         );
  16.  
  17.         public static readonly UserEntity Frantisek = new(
  18.             Id: Guid.Parse(input: "DF935095-8709-4040-A2BB-B6F97CB496DC"),
  19.             Name: "Frantisek",
  20.             Role: "Driver",
  21.             Surname: "Cerstvy",
  22.             UserImageUrl: @"https://png.pngitem.com/pimgs/s/575-5754610_bus-driver-png-bus-driver-images-cartoon-transparent.png"
  23.         );
  24.  
  25.         public static readonly UserEntity Krystof = new(
  26.             Id: Guid.Parse(input: "DF935095-8709-4040-A2BB-B6F97CB496DC"),
  27.             Name: "Krystof",
  28.             Role: "User",
  29.             Surname: "Dolezal",
  30.             UserImageUrl: @"https://png.pngitem.com/pimgs/s/575-5754610_bus-driver-png-bus-driver-images-cartoon-transparent.png"
  31.         );
  32.  
  33.         public static void ProdSeed(this ModelBuilder modelBuilder)
  34.         {
  35.             modelBuilder.Entity<UserEntity>().HasData(Ivan);
  36.             modelBuilder.Entity<UserEntity>().HasData(Frantisek);
  37.             modelBuilder.Entity<UserEntity>().HasData(Krystof);
  38.         }
  39.     }
  40. }
  41.  
  42.  
  43. using System;
  44. using CarPooling.BL.ProdSeeds;
  45. using Microsoft.EntityFrameworkCore;
  46. using CarPooling.DAL.Entities;
  47. using CarPooling.DAL.Enums;
  48. using CarPooling.DAL.Seeds;
  49.  
  50. namespace CarPooling.Bl.ProdSeeds
  51. {
  52.     public static class ProdSeatsSeeds
  53.     {
  54.         public static readonly SeatEntity Seat1 = new(
  55.             Id: Guid.Parse(input: "DF935095-8709-4040-7777-B6F97CB416DC"),
  56.             UserEntityId: ProdCUsersSeeds.Krystof.Id,
  57.             RideEntityId: ProdRidesSeeds.Ride1.Id
  58.         )
  59.         {
  60.             UserEntity = ProdCUsersSeeds.Krystof,
  61.             RideEntity = ProdRidesSeeds.Ride1
  62.         };
  63.  
  64.         public static readonly SeatEntity Seat2 = new(
  65.             Id: Guid.Parse(input: "DF935095-8709-4040-6677-B6F97CB416DC"),
  66.             UserEntityId: ProdCUsersSeeds.Krystof.Id,
  67.             RideEntityId: ProdRidesSeeds.Ride2.Id
  68.         )
  69.         {
  70.             UserEntity = ProdCUsersSeeds.Krystof,
  71.             RideEntity = ProdRidesSeeds.Ride2
  72.         };
  73.         public static void Seed(this ModelBuilder modelBuilder)
  74.         {
  75.             modelBuilder.Entity<CarEntity>().HasData(Seat1);
  76.             modelBuilder.Entity<CarEntity>().HasData(Seat2);
  77.         }
  78.     }
  79. }
  80.  
  81.  
  82. using System;
  83. using CarPooling.BL.ProdSeeds;
  84. using Microsoft.EntityFrameworkCore;
  85. using CarPooling.DAL.Entities;
  86. using CarPooling.DAL.Enums;
  87.  
  88. namespace CarPooling.Bl.ProdSeeds
  89. {
  90.     public static class ProdRidesSeeds
  91.     {
  92.         public static readonly RideEntity Ride1 = new(
  93.             Id: Guid.Parse(input: "9D2B0228-4D0D-8888-8B49-01A698857709"),
  94.             BeginCityId: ProdCitiesSeeds.Brno.Id,
  95.             EndCityId: ProdCitiesSeeds.Praha.Id,
  96.             BeginTime: new DateTime(2022, 5, 17, 20, 0, 0),
  97.             EndTime: new DateTime(2022, 6, 18, 23, 30, 0),
  98.             Description: "2 mista pro deti, zadne zavazadlo",
  99.             Price: 5,
  100.             EmptySeats: 1,
  101.             UserEntityId: ProdCUsersSeeds.Ivan.Id,
  102.             CarEntityId: ProdCarSeed.Chevrolet.Id)
  103.         {
  104.             BeginCity = ProdCitiesSeeds.Brno,
  105.             EndCity = ProdCitiesSeeds.Praha,
  106.             UserEntity = ProdCUsersSeeds.Ivan,
  107.             CarEntity = ProdCarSeed.Chevrolet
  108.         };
  109.  
  110.         public static readonly RideEntity Ride2 = new(
  111.             Id: Guid.Parse(input: "11210228-4D0D-9999-8B49-01A69885A09A"),
  112.             BeginCityId: ProdCitiesSeeds.Olomouc.Id,
  113.             EndCityId: ProdCitiesSeeds.Zlicin.Id,
  114.             BeginTime: new DateTime(2022, 5, 17, 20, 0, 0),
  115.             EndTime: new DateTime(2022, 5, 17, 23, 30, 0),
  116.             Description: "Zadne zavazadlo",
  117.             Price: 10,
  118.             EmptySeats: 1,
  119.             UserEntityId: ProdCUsersSeeds.Frantisek.Id,
  120.             CarEntityId: ProdCarSeed.Skoda.Id)
  121.         {
  122.             BeginCity = ProdCitiesSeeds.Olomouc,
  123.             EndCity = ProdCitiesSeeds.Zlicin,
  124.             UserEntity = ProdCUsersSeeds.Frantisek,
  125.             CarEntity = ProdCarSeed.Skoda
  126.         };
  127.  
  128.         public static void ProdSeed(this ModelBuilder modelBuilder)
  129.         {
  130.             modelBuilder.Entity<CarEntity>().HasData(Ride1);
  131.             modelBuilder.Entity<CarEntity>().HasData(Ride2);
  132.         }
  133.     }
  134. }
  135.  
  136.  
  137. using System;
  138. using Microsoft.EntityFrameworkCore;
  139. using CarPooling.DAL.Entities;
  140.  
  141. namespace CarPooling.BL.ProdSeeds
  142. {
  143.     public static class ProdCitiesSeeds
  144.     {
  145.         public static readonly CityEntity Praha = new(
  146.             Id: Guid.Parse(input: "06A8A2CF-EA03-0000-A3E4-AA0291FE9C75"),
  147.             CityName: "Praha"
  148.         );
  149.  
  150.         public static readonly CityEntity Brno = new(
  151.             Id: Guid.Parse(input: "7777A2CF-EA03-1111-A3E4-AA0291FE86A1"),
  152.             CityName: "Brno"
  153.         );
  154.  
  155.         public static readonly CityEntity Olomouc = new(
  156.             Id: Guid.Parse(input: "06A8A2CF-EA03-2222-A3E4-AA0291FE9C75"),
  157.             CityName: "Olomouc"
  158.         );
  159.  
  160.         public static readonly CityEntity Zlicin = new(
  161.             Id: Guid.Parse(input: "7777A2CF-EA03-3333-A3E4-AA0291FE86A1"),
  162.             CityName: "Zlicin"
  163.         );
  164.  
  165.         public static void ProdSeed(this ModelBuilder modelBuilder)
  166.         {
  167.             modelBuilder.Entity<CityEntity>().HasData(
  168.                 Praha
  169.             );
  170.             modelBuilder.Entity<CityEntity>().HasData(
  171.                 Brno
  172.             );
  173.             modelBuilder.Entity<CityEntity>().HasData(
  174.                 Olomouc
  175.             );
  176.             modelBuilder.Entity<CityEntity>().HasData(
  177.                 Zlicin
  178.             );
  179.         }
  180.     }
  181. }
  182.  
  183.  
  184. using System;
  185. using Microsoft.EntityFrameworkCore;
  186. using CarPooling.DAL.Entities;
  187. using CarPooling.DAL.Enums;
  188. using CarPooling.DAL.Seeds;
  189.  
  190. namespace CarPooling.BL.ProdSeeds
  191. {
  192.     public static class ProdCarSeed
  193.     {
  194.         public static readonly CarEntity Mazda = new(
  195.             Id: Guid.Parse(input: "9D2B0228-4D0D-0000-8B49-01A698857711"),
  196.             Model: "Mazda-MX5",
  197.             LicensePlate: "4A23000",
  198.             Type: CarType.Sports_car,
  199.             CarImageUrl:
  200.             @"https://png.pngitem.com/pimgs/s/138-1387238_land-vehicle-muscle-car-hardtop-chevrolet-chevelle-full.png",
  201.             NSeats: 1,
  202.             RegistrationDate: new DateTime(2022, 5, 10),
  203.             UserEntityId: ProdCUsersSeeds.Frantisek.Id
  204.         )
  205.         {
  206.             UserEntity = ProdCUsersSeeds.Frantisek
  207.         };
  208.  
  209.         public static readonly CarEntity Skoda = new(
  210.             Id: Guid.Parse(input: "9D2B0228-4D0D-1111-8B49-01A698857711"),
  211.             Model: "Skoda-Rapid",
  212.             LicensePlate: "0A23000",
  213.             Type: CarType.Sedan,
  214.             CarImageUrl:
  215.             @"https://png.pngitem.com/pimgs/s/138-1387238_land-vehicle-muscle-car-hardtop-chevrolet-chevelle-full.png",
  216.             NSeats: 5,
  217.             RegistrationDate: new DateTime(2022, 4, 17),
  218.             UserEntityId: ProdCUsersSeeds.Frantisek.Id
  219.         )
  220.         {
  221.             UserEntity = ProdCUsersSeeds.Frantisek
  222.         };
  223.  
  224.         public static readonly CarEntity Chevrolet = new(
  225.             Id: Guid.Parse(input: "9D2B0228-4D0D-2222-8B49-01A698857711"),
  226.             Model: "Chevrolet-Сhevelle",
  227.             LicensePlate: "1A23000",
  228.             Type: CarType.Sedan,
  229.             CarImageUrl:
  230.             @"https://png.pngitem.com/pimgs/s/138-1387238_land-vehicle-muscle-car-hardtop-chevrolet-chevelle-full.png",
  231.             NSeats: 5,
  232.             RegistrationDate: new DateTime(2022, 8, 17),
  233.             UserEntityId: ProdCUsersSeeds.Ivan.Id
  234.         )
  235.         {
  236.             UserEntity = ProdCUsersSeeds.Ivan
  237.         };
  238.  
  239.         public static void ProdSeed(this ModelBuilder modelBuilder)
  240.         {
  241.             modelBuilder.Entity<CarEntity>().HasData(Chevrolet);
  242.             modelBuilder.Entity<CarEntity>().HasData(Mazda);
  243.             modelBuilder.Entity<CarEntity>().HasData(Skoda);
  244.         }
  245.     }
  246. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement