Corret Models Unit and Category
This commit is contained in:
@@ -397,3 +397,4 @@ FodyWeavers.xsd
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
src/Recruitment.Tool.xml
|
||||
/Francesco.Recipes.World/Migrations/20250304095839_AddFewNewBackendModels.Designer.cs
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
namespace Francesco.Recipes.World.Data;
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
namespace Francesco.Recipes.World.Data
|
||||
{
|
||||
using Francesco.Recipes.World.Models.BackendModels;
|
||||
using Francesco.Recipes.World.Models.BackendModels.Category;
|
||||
using Francesco.Recipes.World.Models.BackendModels.Favorit;
|
||||
@@ -51,12 +50,10 @@ public class FrancescosRecipesWorldDbContext : DbContext
|
||||
|
||||
return base.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
if (builder is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(builder));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(builder);
|
||||
|
||||
SeedData(builder);
|
||||
|
||||
@@ -71,10 +68,11 @@ public class FrancescosRecipesWorldDbContext : DbContext
|
||||
modelBuilder.Entity<Unit>()
|
||||
.HasData(GetUnits());
|
||||
}
|
||||
|
||||
private static IEnumerable<Category> GetCategories()
|
||||
{
|
||||
return new List<Category>()
|
||||
{
|
||||
return
|
||||
[
|
||||
new Category { Id = Guid.Parse("b248244f-f21c-4555-a14d-5dd49a2717cf"), Name = "Vorspeisen & Snacks" },
|
||||
new Category { Id = Guid.Parse("5186c5d6-5aff-4a6e-baf4-b61b72d889fe"), Name = "Erste Gänge" },
|
||||
new Category { Id = Guid.Parse("abbc6bb0-97ea-49f5-b31e-6507eb784fd1"), Name = "Hauptgerichte" },
|
||||
@@ -85,13 +83,13 @@ public class FrancescosRecipesWorldDbContext : DbContext
|
||||
new Category { Id = Guid.Parse("d332f88d-d241-48c5-a2f2-bfd124eada7e"), Name = "Soßen & Saucen" },
|
||||
new Category { Id = Guid.Parse("23b1c740-e427-44f9-a6ea-d33d3f30f05a"), Name = "Marmeladen & Eingemachtes" },
|
||||
new Category { Id = Guid.Parse("0a91a200-dc76-4e00-b38c-b38cab5b69d7"), Name = "Getränke" },
|
||||
};
|
||||
];
|
||||
}
|
||||
|
||||
private static IEnumerable<Unit> GetUnits()
|
||||
{
|
||||
return new List<Unit>()
|
||||
{
|
||||
return
|
||||
[
|
||||
new Unit { Id = Guid.Parse("62eb2c11-8768-46fb-9db0-c77f940bb4aa"), Name = "liter", Symbol = "l" },
|
||||
new Unit { Id = Guid.Parse("6c41f7e6-ca75-49cc-8541-cebd5a9c560b"), Name = "gramm", Symbol = "g" },
|
||||
new Unit { Id = Guid.Parse("7e3d1b86-ac48-45d6-814e-d3492a86db1d"), Name = "kilogramm", Symbol = "kg" },
|
||||
@@ -103,6 +101,7 @@ public class FrancescosRecipesWorldDbContext : DbContext
|
||||
new Unit { Id = Guid.Parse("66556e0e-eb2b-4bc3-9a56-135dd508ed09"), Name = "zehe", Symbol = "zehe" },
|
||||
new Unit { Id = Guid.Parse("2e9894ac-14fa-43fd-ba07-35cdd8ebd461"), Name = "teelöffel", Symbol = "TL" },
|
||||
new Unit { Id = Guid.Parse("24a91b89-3389-4465-89e4-2f70d2ea6fd7"), Name = "esslöffel", Symbol = "EL" },
|
||||
};
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
public class Category
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public virtual ICollection<Recipe> Recipes { get; set; } = new List<Recipe>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace Francesco.Recipes.World.Models.BackendModels.Unit
|
||||
public class Unit
|
||||
{
|
||||
public Guid Id{ get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Symbol { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Symbol { get; set; }
|
||||
public virtual ICollection<RecipeIngredient> RecipeIngredient { get; set; } = new List<RecipeIngredient>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user