Lagt till nya entiteter för Gameround och GamePoints
Migrerat och byggt ut databasen
This commit is contained in:
@ -24,7 +24,7 @@ public class GamePointRepository : IRepository<GamePoint>
|
||||
public async Task<bool> Save(GamePoint entity)
|
||||
{
|
||||
var res = false;
|
||||
if ((entity.GameHeatRegNr == 0)
|
||||
if ((entity.GameRoundRegNr == 0)
|
||||
|| (entity.GameRegPoints == 0))
|
||||
{
|
||||
return res; // Validation failed
|
||||
|
||||
61
GreadyPoang.DataLayer/DataClasses/GameRoundRepository.cs
Normal file
61
GreadyPoang.DataLayer/DataClasses/GameRoundRepository.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GreadyPoang.DataLayer;
|
||||
|
||||
public class GameRoundRepository : IRepository<GameRound>
|
||||
{
|
||||
private readonly DataContext _dataContext;
|
||||
|
||||
public GameRoundRepository(DataContext dataContext)
|
||||
{
|
||||
_dataContext = dataContext;
|
||||
}
|
||||
|
||||
public bool Delete(GameRound entity)
|
||||
{
|
||||
var res = false;
|
||||
try
|
||||
{
|
||||
_dataContext.GameRounds.Remove(entity);
|
||||
_dataContext.SaveChanges();
|
||||
res = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"Error deleting GameRound: {ex.Message}");
|
||||
res = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<GameRound>> Get()
|
||||
{
|
||||
return await _dataContext.GameRounds.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<GameRound?> Get(int id)
|
||||
{
|
||||
return await _dataContext.GameRounds.FindAsync(id);
|
||||
}
|
||||
|
||||
public async Task<bool> Save(GameRound entity)
|
||||
{
|
||||
var res = false;
|
||||
if (entity.GameRoundId == 0)
|
||||
{
|
||||
_dataContext.GameRounds.Add(entity);
|
||||
await _dataContext.SaveChangesAsync();
|
||||
res = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_dataContext.GameRounds.Update(entity);
|
||||
await _dataContext.SaveChangesAsync();
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ public class DataContext : DbContext
|
||||
//public DbSet<User> Users => Set<User>();
|
||||
public DbSet<Participant> Participants { get; set; }
|
||||
public DbSet<GamePoint> GamePoints { get; set; }
|
||||
public DbSet<GameRound> GameRounds { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -21,12 +22,18 @@ public class DataContext : DbContext
|
||||
new Participant { ParticipantId = 2, FirstName = "Jane", LastName = "Black", Email = "jb@gmail.com" },
|
||||
new Participant { ParticipantId = 3, FirstName = "Mary", LastName = "White", Email = "mw@gmail.com" }
|
||||
);
|
||||
modelBuilder.Entity<GamePoint>().HasData(
|
||||
new GamePoint { GamePointId = 1, ParticipantId = 1, GameHeatId = 0, GameDate = new DateTime(2025, 10, 15, 20, 10, 15), GameHeatRegNr = 1, GameRegPoints = 1050 },
|
||||
new GamePoint { GamePointId = 2, ParticipantId = 1, GameHeatId = 0, GameDate = new DateTime(2025, 10, 15, 20, 15, 15), GameHeatRegNr = 3, GameRegPoints = 350 },
|
||||
new GamePoint { GamePointId = 3, ParticipantId = 3, GameHeatId = 0, GameDate = new DateTime(2025, 10, 15, 20, 12, 15), GameHeatRegNr = 2, GameRegPoints = 1000 },
|
||||
new GamePoint { GamePointId = 4, ParticipantId = 3, GameHeatId = 0, GameDate = new DateTime(2025, 10, 15, 20, 20, 15), GameHeatRegNr = 4, GameRegPoints = 400 }
|
||||
modelBuilder.Entity<GameRound>().HasData(
|
||||
new GameRound { GameRoundId = 1, GameRoundStartDate = new DateTime(2025, 10, 15, 19, 10, 15), GameRoundFinished = DateTime.MinValue },
|
||||
new GameRound { GameRoundId = 2, GameRoundStartDate = new DateTime(2025, 09, 15, 19, 10, 15), GameRoundFinished = DateTime.MinValue },
|
||||
new GameRound { GameRoundId = 3, GameRoundStartDate = new DateTime(2025, 09, 20, 19, 10, 15), GameRoundFinished = DateTime.MinValue }
|
||||
);
|
||||
modelBuilder.Entity<GamePoint>().HasData(
|
||||
new GamePoint { GamePointId = 1, ParticipantId = 1, GameRoundId = 2, GameDate = new DateTime(2025, 10, 15, 20, 10, 15), GameRoundRegNr = 1, GameRegPoints = 1050, PointStatus = GamePointStatus.New },
|
||||
new GamePoint { GamePointId = 2, ParticipantId = 1, GameRoundId = 2, GameDate = new DateTime(2025, 10, 15, 20, 15, 15), GameRoundRegNr = 3, GameRegPoints = 350, PointStatus = GamePointStatus.New },
|
||||
new GamePoint { GamePointId = 3, ParticipantId = 3, GameRoundId = 2, GameDate = new DateTime(2025, 10, 15, 20, 12, 15), GameRoundRegNr = 2, GameRegPoints = 1000, PointStatus = GamePointStatus.New },
|
||||
new GamePoint { GamePointId = 4, ParticipantId = 3, GameRoundId = 2, GameDate = new DateTime(2025, 10, 15, 20, 20, 15), GameRoundRegNr = 4, GameRegPoints = 400, PointStatus = GamePointStatus.New }
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
135
GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.Designer.cs
generated
Normal file
135
GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.Designer.cs
generated
Normal file
@ -0,0 +1,135 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20250903062957_FixHeatToRoundParameter")]
|
||||
partial class FixHeatToRoundParameter
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
|
||||
{
|
||||
b.Property<int>("GamePointId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("GameDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("GameHeatId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameHeatRegNr")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRegPoints")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("ParticipantId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("GamePointId");
|
||||
|
||||
b.ToTable("GamePoints");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
GamePointId = 1,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified),
|
||||
GameHeatId = 0,
|
||||
GameHeatRegNr = 1,
|
||||
GameRegPoints = 1050,
|
||||
ParticipantId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 2,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified),
|
||||
GameHeatId = 0,
|
||||
GameHeatRegNr = 3,
|
||||
GameRegPoints = 350,
|
||||
ParticipantId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 3,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified),
|
||||
GameHeatId = 0,
|
||||
GameHeatRegNr = 2,
|
||||
GameRegPoints = 1000,
|
||||
ParticipantId = 3
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 4,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified),
|
||||
GameHeatId = 0,
|
||||
GameHeatRegNr = 4,
|
||||
GameRegPoints = 400,
|
||||
ParticipantId = 3
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
|
||||
{
|
||||
b.Property<int>("ParticipantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("ParticipantId");
|
||||
|
||||
b.ToTable("Participants");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
ParticipantId = 1,
|
||||
Email = "John.Doe@gmail.com",
|
||||
FirstName = "John",
|
||||
LastName = "Doe"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 2,
|
||||
Email = "jb@gmail.com",
|
||||
FirstName = "Jane",
|
||||
LastName = "Black"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 3,
|
||||
Email = "mw@gmail.com",
|
||||
FirstName = "Mary",
|
||||
LastName = "White"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixHeatToRoundParameter : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
135
GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.Designer.cs
generated
Normal file
135
GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.Designer.cs
generated
Normal file
@ -0,0 +1,135 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20250903070200_FixHeatToRoundParams")]
|
||||
partial class FixHeatToRoundParams
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
|
||||
{
|
||||
b.Property<int>("GamePointId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("GameDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("GameRegPoints")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundRegNr")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("ParticipantId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("GamePointId");
|
||||
|
||||
b.ToTable("GamePoints");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
GamePointId = 1,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 1050,
|
||||
GameRoundId = 0,
|
||||
GameRoundRegNr = 1,
|
||||
ParticipantId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 2,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 350,
|
||||
GameRoundId = 0,
|
||||
GameRoundRegNr = 3,
|
||||
ParticipantId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 3,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 1000,
|
||||
GameRoundId = 0,
|
||||
GameRoundRegNr = 2,
|
||||
ParticipantId = 3
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 4,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 400,
|
||||
GameRoundId = 0,
|
||||
GameRoundRegNr = 4,
|
||||
ParticipantId = 3
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
|
||||
{
|
||||
b.Property<int>("ParticipantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("ParticipantId");
|
||||
|
||||
b.ToTable("Participants");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
ParticipantId = 1,
|
||||
Email = "John.Doe@gmail.com",
|
||||
FirstName = "John",
|
||||
LastName = "Doe"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 2,
|
||||
Email = "jb@gmail.com",
|
||||
FirstName = "Jane",
|
||||
LastName = "Black"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 3,
|
||||
Email = "mw@gmail.com",
|
||||
FirstName = "Mary",
|
||||
LastName = "White"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixHeatToRoundParams : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "GameHeatRegNr",
|
||||
table: "GamePoints",
|
||||
newName: "GameRoundRegNr");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "GameHeatId",
|
||||
table: "GamePoints",
|
||||
newName: "GameRoundId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "GameRoundRegNr",
|
||||
table: "GamePoints",
|
||||
newName: "GameHeatRegNr");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "GameRoundId",
|
||||
table: "GamePoints",
|
||||
newName: "GameHeatId");
|
||||
}
|
||||
}
|
||||
}
|
||||
135
GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.Designer.cs
generated
Normal file
135
GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.Designer.cs
generated
Normal file
@ -0,0 +1,135 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20250903074537_AddedStatusEnum")]
|
||||
partial class AddedStatusEnum
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
|
||||
{
|
||||
b.Property<int>("GamePointId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("GameDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("GameRegPoints")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundRegNr")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("ParticipantId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("GamePointId");
|
||||
|
||||
b.ToTable("GamePoints");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
GamePointId = 1,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 1050,
|
||||
GameRoundId = 0,
|
||||
GameRoundRegNr = 1,
|
||||
ParticipantId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 2,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 350,
|
||||
GameRoundId = 0,
|
||||
GameRoundRegNr = 3,
|
||||
ParticipantId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 3,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 1000,
|
||||
GameRoundId = 0,
|
||||
GameRoundRegNr = 2,
|
||||
ParticipantId = 3
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 4,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 400,
|
||||
GameRoundId = 0,
|
||||
GameRoundRegNr = 4,
|
||||
ParticipantId = 3
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
|
||||
{
|
||||
b.Property<int>("ParticipantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("ParticipantId");
|
||||
|
||||
b.ToTable("Participants");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
ParticipantId = 1,
|
||||
Email = "John.Doe@gmail.com",
|
||||
FirstName = "John",
|
||||
LastName = "Doe"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 2,
|
||||
Email = "jb@gmail.com",
|
||||
FirstName = "Jane",
|
||||
LastName = "Black"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 3,
|
||||
Email = "mw@gmail.com",
|
||||
FirstName = "Mary",
|
||||
LastName = "White"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedStatusEnum : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
179
GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.Designer.cs
generated
Normal file
179
GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.Designer.cs
generated
Normal file
@ -0,0 +1,179 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20250903195147_AddedTableGameRounds")]
|
||||
partial class AddedTableGameRounds
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
|
||||
{
|
||||
b.Property<int>("GamePointId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("GameDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("GameRegPoints")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundRegNr")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("ParticipantId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("PointStatus")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("GamePointId");
|
||||
|
||||
b.ToTable("GamePoints");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
GamePointId = 1,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 1050,
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 1,
|
||||
ParticipantId = 1,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 2,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 350,
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 3,
|
||||
ParticipantId = 1,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 3,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 1000,
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 2,
|
||||
ParticipantId = 3,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 4,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 400,
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 4,
|
||||
ParticipantId = 3,
|
||||
PointStatus = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.GameRound", b =>
|
||||
{
|
||||
b.Property<int>("GameRoundId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("GameRoundFinished")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("GameRoundStartDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("GameRoundId");
|
||||
|
||||
b.ToTable("GameRounds");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
GameRoundId = 1,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
},
|
||||
new
|
||||
{
|
||||
GameRoundId = 2,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
},
|
||||
new
|
||||
{
|
||||
GameRoundId = 3,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
|
||||
{
|
||||
b.Property<int>("ParticipantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("ParticipantId");
|
||||
|
||||
b.ToTable("Participants");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
ParticipantId = 1,
|
||||
Email = "John.Doe@gmail.com",
|
||||
FirstName = "John",
|
||||
LastName = "Doe"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 2,
|
||||
Email = "jb@gmail.com",
|
||||
FirstName = "Jane",
|
||||
LastName = "Black"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 3,
|
||||
Email = "mw@gmail.com",
|
||||
FirstName = "Mary",
|
||||
LastName = "White"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedTableGameRounds : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PointStatus",
|
||||
table: "GamePoints",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GameRounds",
|
||||
columns: table => new
|
||||
{
|
||||
GameRoundId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
GameRoundFinished = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
GameRoundStartDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GameRounds", x => x.GameRoundId);
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "GamePoints",
|
||||
keyColumn: "GamePointId",
|
||||
keyValue: 1,
|
||||
columns: new[] { "GameRoundId", "PointStatus" },
|
||||
values: new object[] { 2, 0 });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "GamePoints",
|
||||
keyColumn: "GamePointId",
|
||||
keyValue: 2,
|
||||
columns: new[] { "GameRoundId", "PointStatus" },
|
||||
values: new object[] { 2, 0 });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "GamePoints",
|
||||
keyColumn: "GamePointId",
|
||||
keyValue: 3,
|
||||
columns: new[] { "GameRoundId", "PointStatus" },
|
||||
values: new object[] { 2, 0 });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "GamePoints",
|
||||
keyColumn: "GamePointId",
|
||||
keyValue: 4,
|
||||
columns: new[] { "GameRoundId", "PointStatus" },
|
||||
values: new object[] { 2, 0 });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "GameRounds",
|
||||
columns: new[] { "GameRoundId", "GameRoundFinished", "GameRoundStartDate" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) },
|
||||
{ 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) },
|
||||
{ 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified) }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "GameRounds");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PointStatus",
|
||||
table: "GamePoints");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "GamePoints",
|
||||
keyColumn: "GamePointId",
|
||||
keyValue: 1,
|
||||
column: "GameRoundId",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "GamePoints",
|
||||
keyColumn: "GamePointId",
|
||||
keyValue: 2,
|
||||
column: "GameRoundId",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "GamePoints",
|
||||
keyColumn: "GamePointId",
|
||||
keyValue: 3,
|
||||
column: "GameRoundId",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "GamePoints",
|
||||
keyColumn: "GamePointId",
|
||||
keyValue: 4,
|
||||
column: "GameRoundId",
|
||||
value: 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
179
GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.Designer.cs
generated
Normal file
179
GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.Designer.cs
generated
Normal file
@ -0,0 +1,179 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20250903195935_ChangedUpdateOrderInSeeding")]
|
||||
partial class ChangedUpdateOrderInSeeding
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
|
||||
{
|
||||
b.Property<int>("GamePointId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("GameDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("GameRegPoints")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundRegNr")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("ParticipantId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("PointStatus")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("GamePointId");
|
||||
|
||||
b.ToTable("GamePoints");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
GamePointId = 1,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 1050,
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 1,
|
||||
ParticipantId = 1,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 2,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 350,
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 3,
|
||||
ParticipantId = 1,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 3,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 1000,
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 2,
|
||||
ParticipantId = 3,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 4,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified),
|
||||
GameRegPoints = 400,
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 4,
|
||||
ParticipantId = 3,
|
||||
PointStatus = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.GameRound", b =>
|
||||
{
|
||||
b.Property<int>("GameRoundId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("GameRoundFinished")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("GameRoundStartDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("GameRoundId");
|
||||
|
||||
b.ToTable("GameRounds");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
GameRoundId = 1,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
},
|
||||
new
|
||||
{
|
||||
GameRoundId = 2,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
},
|
||||
new
|
||||
{
|
||||
GameRoundId = 3,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
|
||||
{
|
||||
b.Property<int>("ParticipantId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("ParticipantId");
|
||||
|
||||
b.ToTable("Participants");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
ParticipantId = 1,
|
||||
Email = "John.Doe@gmail.com",
|
||||
FirstName = "John",
|
||||
LastName = "Doe"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 2,
|
||||
Email = "jb@gmail.com",
|
||||
FirstName = "Jane",
|
||||
LastName = "Black"
|
||||
},
|
||||
new
|
||||
{
|
||||
ParticipantId = 3,
|
||||
Email = "mw@gmail.com",
|
||||
FirstName = "Mary",
|
||||
LastName = "White"
|
||||
});
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ChangedUpdateOrderInSeeding : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26,18 +26,21 @@ namespace GreadyPoang.DataLayer.Migrations
|
||||
b.Property<DateTime>("GameDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("GameHeatId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameHeatRegNr")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRegPoints")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GameRoundRegNr")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("ParticipantId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("PointStatus")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("GamePointId");
|
||||
|
||||
b.ToTable("GamePoints");
|
||||
@ -47,37 +50,78 @@ namespace GreadyPoang.DataLayer.Migrations
|
||||
{
|
||||
GamePointId = 1,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified),
|
||||
GameHeatId = 0,
|
||||
GameHeatRegNr = 1,
|
||||
GameRegPoints = 1050,
|
||||
ParticipantId = 1
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 1,
|
||||
ParticipantId = 1,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 2,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified),
|
||||
GameHeatId = 0,
|
||||
GameHeatRegNr = 3,
|
||||
GameRegPoints = 350,
|
||||
ParticipantId = 1
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 3,
|
||||
ParticipantId = 1,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 3,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified),
|
||||
GameHeatId = 0,
|
||||
GameHeatRegNr = 2,
|
||||
GameRegPoints = 1000,
|
||||
ParticipantId = 3
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 2,
|
||||
ParticipantId = 3,
|
||||
PointStatus = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
GamePointId = 4,
|
||||
GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified),
|
||||
GameHeatId = 0,
|
||||
GameHeatRegNr = 4,
|
||||
GameRegPoints = 400,
|
||||
ParticipantId = 3
|
||||
GameRoundId = 2,
|
||||
GameRoundRegNr = 4,
|
||||
ParticipantId = 3,
|
||||
PointStatus = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GreadyPoang.EntityLayer.GameRound", b =>
|
||||
{
|
||||
b.Property<int>("GameRoundId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("GameRoundFinished")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("GameRoundStartDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("GameRoundId");
|
||||
|
||||
b.ToTable("GameRounds");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
GameRoundId = 1,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
},
|
||||
new
|
||||
{
|
||||
GameRoundId = 2,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
},
|
||||
new
|
||||
{
|
||||
GameRoundId = 3,
|
||||
GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
GameRoundStartDate = new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -9,18 +9,20 @@ public class GamePoint : EntityBase
|
||||
{
|
||||
_gamePointId = 0;
|
||||
_participantId = 0;
|
||||
_gameHeatId = 0;
|
||||
_gameRoundId = 0;
|
||||
_gameDate = DateTime.Now;
|
||||
_gameHeatRegNr = 0;
|
||||
_gameRoundRegNr = 0;
|
||||
_gameRegPoints = 0;
|
||||
_pointStatus = GamePointStatus.New;
|
||||
}
|
||||
|
||||
private int _gamePointId;
|
||||
private int _participantId;
|
||||
private int _gameHeatId;
|
||||
private int _gameRoundId;
|
||||
private DateTime _gameDate;
|
||||
private int _gameHeatRegNr;
|
||||
private int _gameRoundRegNr;
|
||||
private int _gameRegPoints;
|
||||
private GamePointStatus _pointStatus;
|
||||
|
||||
[PrimaryKey]
|
||||
[AutoIncrement]
|
||||
@ -45,14 +47,14 @@ public class GamePoint : EntityBase
|
||||
RaisePropertyChanged(nameof(ParticipantId));
|
||||
}
|
||||
}
|
||||
[Column("GameHeatId")]
|
||||
public int GameHeatId
|
||||
[Column("GameRoundId")]
|
||||
public int GameRoundId
|
||||
{
|
||||
get { return _gameHeatId; }
|
||||
get { return _gameRoundId; }
|
||||
set
|
||||
{
|
||||
_gameHeatId = value;
|
||||
RaisePropertyChanged(nameof(GameHeatId));
|
||||
_gameRoundId = value;
|
||||
RaisePropertyChanged(nameof(GameRoundId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,14 +69,14 @@ public class GamePoint : EntityBase
|
||||
}
|
||||
}
|
||||
|
||||
[Column("GameHeatRegNr")]
|
||||
public int GameHeatRegNr
|
||||
[Column("GameRoundRegNr")]
|
||||
public int GameRoundRegNr
|
||||
{
|
||||
get { return _gameHeatRegNr; }
|
||||
get { return _gameRoundRegNr; }
|
||||
set
|
||||
{
|
||||
_gameHeatRegNr = value;
|
||||
RaisePropertyChanged(nameof(GameHeatRegNr));
|
||||
_gameRoundRegNr = value;
|
||||
RaisePropertyChanged(nameof(GameRoundRegNr));
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,4 +90,17 @@ public class GamePoint : EntityBase
|
||||
RaisePropertyChanged(nameof(GameRegPoints));
|
||||
}
|
||||
}
|
||||
|
||||
[Column("PointStatus")]
|
||||
public GamePointStatus PointStatus
|
||||
{
|
||||
get { return _pointStatus; }
|
||||
set
|
||||
{
|
||||
_pointStatus = value;
|
||||
RaisePropertyChanged(nameof(PointStatus));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
57
GreadyPoang.EntityLayer/EntityClasses/GameRound.cs
Normal file
57
GreadyPoang.EntityLayer/EntityClasses/GameRound.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using Common.Library;
|
||||
using SQLite;
|
||||
|
||||
namespace GreadyPoang.EntityLayer;
|
||||
|
||||
|
||||
[Table("GameRound")]
|
||||
|
||||
public class GameRound : EntityBase
|
||||
{
|
||||
public GameRound()
|
||||
{
|
||||
_gameRoundId = 0;
|
||||
_gameRoundStartDate = DateTime.Now;
|
||||
_gameRoundFinished = null;
|
||||
}
|
||||
|
||||
private int _gameRoundId;
|
||||
private DateTime _gameRoundStartDate;
|
||||
private DateTime? _gameRoundFinished;
|
||||
|
||||
[Column("GameRoundFinished")]
|
||||
public DateTime? GameRoundFinished
|
||||
{
|
||||
get { return _gameRoundFinished; }
|
||||
set
|
||||
{
|
||||
_gameRoundFinished = value;
|
||||
RaisePropertyChanged(nameof(GameRoundFinished));
|
||||
}
|
||||
}
|
||||
|
||||
[Column("GameRoundStartDate")]
|
||||
public DateTime GameRoundStartDate
|
||||
{
|
||||
get { return _gameRoundStartDate; }
|
||||
set
|
||||
{
|
||||
_gameRoundStartDate = value;
|
||||
RaisePropertyChanged(nameof(GameRoundStartDate));
|
||||
}
|
||||
}
|
||||
|
||||
[PrimaryKey]
|
||||
[AutoIncrement]
|
||||
[Column("GameRoundId")]
|
||||
public int GameRoundId
|
||||
{
|
||||
get { return _gameRoundId; }
|
||||
set
|
||||
{
|
||||
_gameRoundId = value;
|
||||
RaisePropertyChanged(nameof(GameRoundId));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
9
GreadyPoang.EntityLayer/Enums/GamePointStatus.cs
Normal file
9
GreadyPoang.EntityLayer/Enums/GamePointStatus.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace GreadyPoang.EntityLayer;
|
||||
|
||||
public enum GamePointStatus
|
||||
{
|
||||
New = 0,
|
||||
InProgress = 1,
|
||||
Completed = 2,
|
||||
Cancelled = 3
|
||||
}
|
||||
@ -28,3 +28,6 @@ class Program
|
||||
options.UseSqlite($"Data Source={dbPath}"));
|
||||
});
|
||||
}
|
||||
|
||||
// dotnet ef migrations add FixHeatToRoundParams --project GreadyPoang.DataLayer --startup-project GreadyPoang.Migrations
|
||||
// dotnet ef database update --project GreadyPoang.DataLayer --startup-project GreadyPoang.Migrations
|
||||
@ -18,10 +18,6 @@ public class ParticipantViewModel : ViewModelBase
|
||||
Repository = repo;
|
||||
}
|
||||
|
||||
//public ParticipantViewModel(IRepository<Participant> repo) : base()
|
||||
//{
|
||||
// Repository = repo;
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
namespace GreadyPoang
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
|
||||
namespace GreadyPoang
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
public App(DataContext dataContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
dataContext.Database.EnsureCreated();
|
||||
}
|
||||
|
||||
protected override Window CreateWindow(IActivationState? activationState)
|
||||
|
||||
@ -17,6 +17,10 @@
|
||||
Title="Deltagare"
|
||||
ContentTemplate="{DataTemplate views:ParticipantListView}"
|
||||
Route="ParticipantListView" />
|
||||
<ShellContent
|
||||
Title="Starta Ny Runda"
|
||||
ContentTemplate="{DataTemplate views:RoundStartingView}"
|
||||
Route="RoundStartingView" />
|
||||
</TabBar>
|
||||
|
||||
</Shell>
|
||||
|
||||
@ -88,6 +88,9 @@
|
||||
<MauiXaml Update="Views\ParticipantListView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="Views\RoundStartingView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -29,7 +29,6 @@ public static class MauiProgram
|
||||
{
|
||||
File.WriteAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MauiDataPath_GreadyPoang.txt"), MauiDataPath);
|
||||
}
|
||||
//var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "PoangDB.db");
|
||||
var dbPath = Path.Combine(MauiDataPath, "PoangDB.db");
|
||||
options.UseSqlite($"Data Source={dbPath}");
|
||||
});
|
||||
|
||||
@ -6,15 +6,22 @@
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
IgnorableNamespaces="uap rescap">
|
||||
|
||||
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
|
||||
<Identity Name="com.idoit4u.GreadyPoang"
|
||||
Publisher="CN=Idoit4u"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<Properties>
|
||||
<DisplayName>GreadyPoang</DisplayName>
|
||||
<PublisherDisplayName>Idoit4u</PublisherDisplayName>
|
||||
</Properties>
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="BF559627-AEE2-4FB6-899B-B955FD4F3019" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<!--<Properties>
|
||||
<DisplayName>$placeholder$</DisplayName>
|
||||
<PublisherDisplayName>User Name</PublisherDisplayName>
|
||||
<Logo>$placeholder$.png</Logo>
|
||||
</Properties>
|
||||
</Properties>-->
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<Style TargetType="Border"
|
||||
x:Key="Border.Page">
|
||||
<Setter Property="Stroke" Value="CadetBlue" />
|
||||
<Setter Property="BackgroundColor" Value="LightGrey" />
|
||||
<Setter Property="BackgroundColor" Value="LightGray" />
|
||||
<Setter Property="StrokeThickness" Value="1" />
|
||||
<Setter Property="Margin" Value="5" />
|
||||
<Setter Property="HorizontalOptions" Value="Fill" />
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
ViewDescription="Lägg till deltagare här" />
|
||||
<Border Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" Grid.Row="1">
|
||||
<StackLayout Spacing="4" >
|
||||
<FlexLayout Wrap="Wrap">
|
||||
<FlexLayout Wrap="Wrap" >
|
||||
<Label Style="{StaticResource Label}"
|
||||
Text="Deltagare Förnamn:"
|
||||
FontAttributes="Bold"/>
|
||||
@ -68,6 +68,7 @@
|
||||
<HorizontalStackLayout>
|
||||
<Label FontAttributes="Bold"
|
||||
FontSize="Title"
|
||||
TextColor="CadetBlue"
|
||||
Text="{Binding LastNameFirstName}" />
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
|
||||
32
GreadyPoang/Views/RoundStartingView.xaml
Normal file
32
GreadyPoang/Views/RoundStartingView.xaml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
||||
x:Class="GreadyPoang.Views.RoundStartingView"
|
||||
Title="Starta ny Runda">
|
||||
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
||||
<Grid Style="{StaticResource Grid.Page}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<partial:HeaderView Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
ViewTitle="Starta en Spelrunda"
|
||||
ViewDescription="Välj deltagare och initiera spel" />
|
||||
<Border Grid.Row="1" Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" >
|
||||
<Label Text="Här kommer du kunna välja deltagare och starta en ny spelrunda"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center"/>
|
||||
</Border>
|
||||
<Border Grid.Row="2" Stroke="Gold" BackgroundColor="Ivory" StrokeThickness="2" Padding="5">
|
||||
<Label Text="Här kommer en lista på alla spelrundor att visas"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentPage>
|
||||
9
GreadyPoang/Views/RoundStartingView.xaml.cs
Normal file
9
GreadyPoang/Views/RoundStartingView.xaml.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace GreadyPoang.Views;
|
||||
|
||||
public partial class RoundStartingView : ContentPage
|
||||
{
|
||||
public RoundStartingView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@ -6,13 +6,13 @@
|
||||
<Label
|
||||
Text="{Binding ViewTitle}"
|
||||
HorizontalOptions="Center"
|
||||
FontSize="Title" />
|
||||
FontSize="Title" FontAttributes="Bold" TextColor="RoyalBlue" />
|
||||
|
||||
<Label
|
||||
Grid.ColumnSpan="2"
|
||||
Text="{Binding ViewDescription}"
|
||||
HorizontalOptions="Center"
|
||||
FontSize="Body" />
|
||||
FontSize="Subtitle" TextColor="DarkBlue" />
|
||||
|
||||
<BoxView
|
||||
Grid.ColumnSpan="2"
|
||||
|
||||
Reference in New Issue
Block a user