Revert "changes LiebContext, renamed User to LiebUser"

This reverts commit 7b44e41eb2.
This commit is contained in:
t.ruspekhofer 2022-02-20 15:48:20 +01:00
parent 31a0e20f1d
commit e0fd579c00
12 changed files with 20 additions and 31 deletions

View file

@ -12,11 +12,11 @@ namespace Lieb.Data
return; // DB has been seeded return; // DB has been seeded
} }
var users = new LiebUser[] var users = new User[]
{ {
new LiebUser{DiscordUserId=0, Name="Sarah",Birthday=DateTime.Parse("1992-01-15")}, new User{DiscordUserId=0, Name="Sarah",Birthday=DateTime.Parse("1992-01-15")},
new LiebUser{DiscordUserId=0, Name="Lisa",Birthday=DateTime.Parse("1991-02-15")}, new User{DiscordUserId=0, Name="Lisa",Birthday=DateTime.Parse("1991-02-15")},
new LiebUser{DiscordUserId=0, Name="Simon",Birthday=DateTime.Parse("2019-09-01")} new User{DiscordUserId=0, Name="Simon",Birthday=DateTime.Parse("2019-09-01")}
}; };
context.Users.AddRange(users); context.Users.AddRange(users);

View file

@ -6,18 +6,17 @@ using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Lieb.Models; using Lieb.Models;
using Lieb.Models.Raid; using Lieb.Models.Raid;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
namespace Lieb.Data namespace Lieb.Data
{ {
public class LiebContext : IdentityDbContext<LiebUser> public class LiebContext : DbContext
{ {
public LiebContext (DbContextOptions<LiebContext> options) public LiebContext (DbContextOptions<LiebContext> options)
: base(options) : base(options)
{ {
} }
public DbSet<LiebUser> Users { get; set; } public DbSet<User> Users { get; set; }
public DbSet<GuildWars2Account> GuildWars2Account { get; set; } public DbSet<GuildWars2Account> GuildWars2Account { get; set; }
public DbSet<Equipped> Equipped { get; set; } public DbSet<Equipped> Equipped { get; set; }
public DbSet<RaidRole> RaidRoles { get; set; } public DbSet<RaidRole> RaidRoles { get; set; }
@ -32,8 +31,7 @@ namespace Lieb.Data
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
base.OnModelCreating(modelBuilder); modelBuilder.Entity<User>().ToTable("User");
modelBuilder.Entity<LiebUser>().ToTable("User");
modelBuilder.Entity<GuildWars2Account>().ToTable("GuildWars2Account"); modelBuilder.Entity<GuildWars2Account>().ToTable("GuildWars2Account");
modelBuilder.Entity<Equipped>().ToTable("Equipped"); modelBuilder.Entity<Equipped>().ToTable("Equipped");
modelBuilder.Entity<RaidRole>().ToTable("RaidRole"); modelBuilder.Entity<RaidRole>().ToTable("RaidRole");

View file

@ -12,8 +12,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>

View file

@ -21,7 +21,7 @@
public SignUpType SignUpType { get; set; } public SignUpType SignUpType { get; set; }
public Raid Raid { get; set; } public Raid Raid { get; set; }
public LiebUser User { get; set; } = new LiebUser(); public User User { get; set; } = new User();
public GuildWars2Account GuildWars2Account { get; set; } = new GuildWars2Account(); public GuildWars2Account GuildWars2Account { get; set; } = new GuildWars2Account();
public PlannedRaidRole PlannedRaidRole { get; set; } = new PlannedRaidRole(); public PlannedRaidRole PlannedRaidRole { get; set; } = new PlannedRaidRole();
} }

View file

@ -6,7 +6,7 @@
public short Quickness { get; set; } public short Quickness { get; set; }
public short Alacrity { get; set; } public short Alacrity { get; set; }
public short Heal { get; set; } public short Heal { get; set; }
public LiebUser Tank { get; set; } = new LiebUser(); public User Tank { get; set; } = new User();
public bool RandomClass { get; set; } public bool RandomClass { get; set; }
public bool RandomEliteSpecialization { get; set; } public bool RandomEliteSpecialization { get; set; }

View file

@ -1,10 +1,8 @@
using Microsoft.AspNetCore.Identity; namespace Lieb.Models
namespace Lieb.Models
{ {
public class LiebUser : IdentityUser public class User
{ {
public int LiebUserId { get; set; } public int UserId { get; set; }
public ulong DiscordUserId { get; set; } public ulong DiscordUserId { get; set; }
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public string Pronouns { get; set; } = string.Empty; public string Pronouns { get; set; } = string.Empty;

View file

@ -26,7 +26,7 @@ namespace Lieb.Pages.Users
} }
[BindProperty] [BindProperty]
public LiebUser User { get; set; } public User User { get; set; }
// To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
public async Task<IActionResult> OnPostAsync() public async Task<IActionResult> OnPostAsync()

View file

@ -21,7 +21,7 @@ namespace Lieb.Pages.Users
} }
[BindProperty] [BindProperty]
public LiebUser User { get; set; } public User User { get; set; }
public async Task<IActionResult> OnGetAsync(int? id) public async Task<IActionResult> OnGetAsync(int? id)
{ {

View file

@ -20,7 +20,7 @@ namespace Lieb.Pages.Users
_context = context; _context = context;
} }
public LiebUser User { get; set; } public User User { get; set; }
public async Task<IActionResult> OnGetAsync(int? id) public async Task<IActionResult> OnGetAsync(int? id)
{ {

View file

@ -22,7 +22,7 @@ namespace Lieb.Pages.Users
} }
[BindProperty] [BindProperty]
public LiebUser User { get; set; } public User User { get; set; }
public async Task<IActionResult> OnGetAsync(int? id) public async Task<IActionResult> OnGetAsync(int? id)
{ {

View file

@ -20,7 +20,7 @@ namespace Lieb.Pages.Users
_context = context; _context = context;
} }
public IList<LiebUser> User { get;set; } public IList<User> User { get;set; }
public async Task OnGetAsync() public async Task OnGetAsync()
{ {

View file

@ -1,11 +1,10 @@
using Discord.OAuth2; using Discord.OAuth2;
using Lieb.Data; using Lieb.Data;
using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Identity;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
@ -14,10 +13,6 @@ builder.Services.AddRazorPages();
builder.Services.AddDbContext<LiebContext>(options => builder.Services.AddDbContext<LiebContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("LiebContext"))); options.UseSqlServer(builder.Configuration.GetConnectionString("LiebContext")));
/*
builder.Services.AddDefaultIdentity<LiebUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<Lieb2Context>();builder.Services.AddDbContext<Lieb2Context>(options =>
options.UseSqlServer(connectionString));*/
builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder.Services.AddDatabaseDeveloperPageExceptionFilter();