fix: change route number variable type to int

This commit is contained in:
cuqmbr 2022-03-30 18:18:02 +03:00
parent 12809e6ae1
commit 1b3b598539
8 changed files with 41 additions and 12 deletions

View File

@ -11,7 +11,7 @@ using TicketOffice.Data;
namespace TicketOffice.Migrations
{
[DbContext(typeof(TicketOfficeContext))]
[Migration("20220329095305_InitialCreate")]
[Migration("20220330145408_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -54,9 +54,8 @@ namespace TicketOffice.Migrations
b.Property<int>("Capacity")
.HasColumnType("INTEGER");
b.Property<string>("Number")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Number")
.HasColumnType("INTEGER");
b.HasKey("Id");

View File

@ -15,7 +15,7 @@ namespace TicketOffice.Migrations
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Number = table.Column<string>(type: "TEXT", nullable: false),
Number = table.Column<int>(type: "INTEGER", nullable: false),
Capacity = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>

View File

@ -52,9 +52,8 @@ namespace TicketOffice.Migrations
b.Property<int>("Capacity")
.HasColumnType("INTEGER");
b.Property<string>("Number")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Number")
.HasColumnType("INTEGER");
b.HasKey("Id");

View File

@ -6,7 +6,7 @@ public class Route
{
public int Id { get; set; }
public string Number { get; set; }
public int Number { get; set; }
public int Capacity { get; set; }
public ICollection<City> Cities { get; set; }

View File

@ -41,7 +41,7 @@ public class SeedData
context.Route.AddRange(new Route[]
{
new Route {
Number = "0001",
Number = 2,
Capacity = 30,
Cities = new City[]
{
@ -62,11 +62,11 @@ public class SeedData
Name = "Сєвєродонецьк",
ArrivalTime = new DateTime(2022, 03, 28, 9, 55, 0)
}
},
}
},
new Route
{
Number = "0002",
Number = 1,
Capacity = 25,
Cities = new City[]
{
@ -88,6 +88,37 @@ public class SeedData
ArrivalTime = new DateTime(2022, 03, 28, 17, 40, 0)
}
}
},
new Route
{
Number = 3,
Capacity = 30,
Cities = new City[]
{
new City
{
Name = "Кремінна",
ArrivalTime = new DateTime(2022, 03, 28, 9, 20, 0),
DepartureTime = new DateTime(2022, 03, 28, 8, 40, 0),
},
new City
{
Name = "Житлівка",
ArrivalTime = new DateTime(2022, 03, 28, 10, 0, 0),
DepartureTime = new DateTime(2022, 03, 28, 10, 15, 0),
},
new City
{
Name = "Рубіжне",
ArrivalTime = new DateTime(2022, 03, 28, 11, 5, 0),
DepartureTime = new DateTime(2022, 03, 28, 11, 20, 0),
},
new City
{
Name = "Сєвєродонецьк",
ArrivalTime = new DateTime(2022, 03, 28, 11, 55, 0)
}
}
}
});