Compare commits
2 Commits
e94064cff2
...
6cd0f31ef9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cd0f31ef9 | ||
|
|
531c833e76 |
@ -16,6 +16,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Sharer" Version="1.0.0" />
|
||||
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -5,6 +5,6 @@
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
public string? ImageURL { get; set; }
|
||||
public List<CocktailFlasche> Cocktailflaschen { get; } = new();
|
||||
public List<CocktailFlasche> Cocktailflaschen { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,8 @@ namespace CocktailWeb.Data
|
||||
public DbSet<Flasche> Flaschen { get; set; }
|
||||
public DbSet<CocktailFlasche> CocktailFlaschen { get; set; }
|
||||
public DbSet<Cocktail> Cocktails { get; set; }
|
||||
public DbSet<Filler> Fillers { get; set; }
|
||||
|
||||
public DbDataContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
@ -27,6 +29,22 @@ namespace CocktailWeb.Data
|
||||
new Flasche("Wodka") { Id = 2 }
|
||||
);
|
||||
|
||||
modelBuilder.Entity<Filler>().HasData(
|
||||
new Filler() { Id = 1, Pos = 1, Type = Filler.FillerType.Pump },
|
||||
new Filler() { Id = 2, Pos = 2, Type = Filler.FillerType.Pump },
|
||||
new Filler() { Id = 3, Pos = 3, Type = Filler.FillerType.Pump },
|
||||
new Filler() { Id = 4, Pos = 4, Type = Filler.FillerType.Pourer },
|
||||
new Filler() { Id = 5, Pos = 5, Type = Filler.FillerType.Pourer },
|
||||
new Filler() { Id = 6, Pos = 6, Type = Filler.FillerType.Pourer },
|
||||
new Filler() { Id = 7, Pos = 7, Type = Filler.FillerType.Pourer },
|
||||
new Filler() { Id = 8, Pos = 8, Type = Filler.FillerType.Pourer },
|
||||
new Filler() { Id = 9, Pos = 9, Type = Filler.FillerType.Pourer },
|
||||
new Filler() { Id = 10, Pos = 10, Type = Filler.FillerType.Pourer },
|
||||
new Filler() { Id = 11, Pos = 11, Type = Filler.FillerType.Pourer },
|
||||
new Filler() { Id = 12, Pos = 12, Type = Filler.FillerType.Pump },
|
||||
new Filler() { Id = 13, Pos = 13, Type = Filler.FillerType.Pump },
|
||||
new Filler() { Id = 14, Pos = 14, Type = Filler.FillerType.Pump }
|
||||
);
|
||||
|
||||
// modelBuilder.Entity<Cocktail>().HasMany(c => c.CocktailFlaschen).WithOne(c => c.Cocktail).HasForeignKey(c => c.CocktailID);
|
||||
|
||||
|
||||
17
CocktailWeb/Data/Filler.cs
Normal file
17
CocktailWeb/Data/Filler.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace CocktailWeb.Data
|
||||
{
|
||||
public class Filler
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Pos { get; set; }
|
||||
public FillerType Type { get; set; }
|
||||
public Flasche? Flasche { get; set; }
|
||||
|
||||
public enum FillerType
|
||||
{
|
||||
Pump,
|
||||
Pourer
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,6 @@
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
public int? Pos { get; set; }
|
||||
|
||||
public Flasche()
|
||||
{
|
||||
|
||||
Binary file not shown.
13
CocktailWeb/GeneralSettings.cs
Normal file
13
CocktailWeb/GeneralSettings.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace CocktailWeb
|
||||
{
|
||||
public class GeneralSettings
|
||||
{
|
||||
|
||||
public int MaxAllowedUploadSizeInMB { get; set; } = 10;
|
||||
public string ImageUploadDir { get; set; } = "images";
|
||||
|
||||
public string SerialPort { get; set; } = "COM5";
|
||||
|
||||
public int Baudrate { get; set; } = 115200;
|
||||
}
|
||||
}
|
||||
152
CocktailWeb/Migrations/20240131184613_CreateFillerTable.Designer.cs
generated
Normal file
152
CocktailWeb/Migrations/20240131184613_CreateFillerTable.Designer.cs
generated
Normal file
@ -0,0 +1,152 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CocktailWeb.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CocktailWeb.Migrations
|
||||
{
|
||||
[DbContext(typeof(DbDataContext))]
|
||||
[Migration("20240131184613_CreateFillerTable")]
|
||||
partial class CreateFillerTable
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.1");
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Cocktail", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ImageURL")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cocktails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.CocktailFlasche", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CocktailID")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("FlascheID")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Menge")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Reihenfolge")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CocktailID");
|
||||
|
||||
b.HasIndex("FlascheID");
|
||||
|
||||
b.ToTable("CocktailFlaschen");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Filler", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("FlascheId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Pos")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FlascheId");
|
||||
|
||||
b.ToTable("Fillers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Flasche", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Flaschen", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Jägermeister"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Name = "Wodka"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.CocktailFlasche", b =>
|
||||
{
|
||||
b.HasOne("CocktailWeb.Data.Cocktail", "Cocktail")
|
||||
.WithMany("Cocktailflaschen")
|
||||
.HasForeignKey("CocktailID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CocktailWeb.Data.Flasche", "Flasche")
|
||||
.WithMany()
|
||||
.HasForeignKey("FlascheID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Cocktail");
|
||||
|
||||
b.Navigation("Flasche");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Filler", b =>
|
||||
{
|
||||
b.HasOne("CocktailWeb.Data.Flasche", "Flasche")
|
||||
.WithMany()
|
||||
.HasForeignKey("FlascheId");
|
||||
|
||||
b.Navigation("Flasche");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Cocktail", b =>
|
||||
{
|
||||
b.Navigation("Cocktailflaschen");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
70
CocktailWeb/Migrations/20240131184613_CreateFillerTable.cs
Normal file
70
CocktailWeb/Migrations/20240131184613_CreateFillerTable.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CocktailWeb.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CreateFillerTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Pos",
|
||||
table: "Flaschen");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Fillers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Pos = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
FlascheId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Fillers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Fillers_Flaschen_FlascheId",
|
||||
column: x => x.FlascheId,
|
||||
principalTable: "Flaschen",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Fillers_FlascheId",
|
||||
table: "Fillers",
|
||||
column: "FlascheId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Fillers");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Pos",
|
||||
table: "Flaschen",
|
||||
type: "INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Flaschen",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Pos",
|
||||
value: null);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Flaschen",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Pos",
|
||||
value: null);
|
||||
}
|
||||
}
|
||||
}
|
||||
238
CocktailWeb/Migrations/20240205165625_SeedDataFillers.Designer.cs
generated
Normal file
238
CocktailWeb/Migrations/20240205165625_SeedDataFillers.Designer.cs
generated
Normal file
@ -0,0 +1,238 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CocktailWeb.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CocktailWeb.Migrations
|
||||
{
|
||||
[DbContext(typeof(DbDataContext))]
|
||||
[Migration("20240205165625_SeedDataFillers")]
|
||||
partial class SeedDataFillers
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.1");
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Cocktail", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ImageURL")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cocktails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.CocktailFlasche", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CocktailID")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("FlascheID")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Menge")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Reihenfolge")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CocktailID");
|
||||
|
||||
b.HasIndex("FlascheID");
|
||||
|
||||
b.ToTable("CocktailFlaschen");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Filler", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("FlascheId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Pos")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FlascheId");
|
||||
|
||||
b.ToTable("Fillers");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Pos = 1,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Pos = 2,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
Pos = 3,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
Pos = 4,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
Pos = 5,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
Pos = 6,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
Pos = 7,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 8,
|
||||
Pos = 8,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 9,
|
||||
Pos = 9,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 10,
|
||||
Pos = 10,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 11,
|
||||
Pos = 11,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 12,
|
||||
Pos = 12,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 13,
|
||||
Pos = 13,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 14,
|
||||
Pos = 14,
|
||||
Type = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Flasche", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Flaschen", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Jägermeister"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Name = "Wodka"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.CocktailFlasche", b =>
|
||||
{
|
||||
b.HasOne("CocktailWeb.Data.Cocktail", "Cocktail")
|
||||
.WithMany("Cocktailflaschen")
|
||||
.HasForeignKey("CocktailID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CocktailWeb.Data.Flasche", "Flasche")
|
||||
.WithMany()
|
||||
.HasForeignKey("FlascheID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Cocktail");
|
||||
|
||||
b.Navigation("Flasche");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Filler", b =>
|
||||
{
|
||||
b.HasOne("CocktailWeb.Data.Flasche", "Flasche")
|
||||
.WithMany()
|
||||
.HasForeignKey("FlascheId");
|
||||
|
||||
b.Navigation("Flasche");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Cocktail", b =>
|
||||
{
|
||||
b.Navigation("Cocktailflaschen");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
111
CocktailWeb/Migrations/20240205165625_SeedDataFillers.cs
Normal file
111
CocktailWeb/Migrations/20240205165625_SeedDataFillers.cs
Normal file
@ -0,0 +1,111 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace CocktailWeb.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SeedDataFillers : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "Fillers",
|
||||
columns: new[] { "Id", "FlascheId", "Pos", "Type" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, null, 1, 0 },
|
||||
{ 2, null, 2, 0 },
|
||||
{ 3, null, 3, 0 },
|
||||
{ 4, null, 4, 1 },
|
||||
{ 5, null, 5, 1 },
|
||||
{ 6, null, 6, 1 },
|
||||
{ 7, null, 7, 1 },
|
||||
{ 8, null, 8, 1 },
|
||||
{ 9, null, 9, 1 },
|
||||
{ 10, null, 10, 1 },
|
||||
{ 11, null, 11, 1 },
|
||||
{ 12, null, 12, 0 },
|
||||
{ 13, null, 13, 0 },
|
||||
{ 14, null, 14, 0 }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 4);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 5);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 6);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 7);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 8);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 9);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 10);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 11);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 12);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 13);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Fillers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 14);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15,7 +15,7 @@ namespace CocktailWeb.Migrations
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "7.0.14");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.1");
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Cocktail", b =>
|
||||
{
|
||||
@ -62,6 +62,114 @@ namespace CocktailWeb.Migrations
|
||||
b.ToTable("CocktailFlaschen");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Filler", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("FlascheId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Pos")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FlascheId");
|
||||
|
||||
b.ToTable("Fillers");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Pos = 1,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Pos = 2,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
Pos = 3,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
Pos = 4,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
Pos = 5,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
Pos = 6,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
Pos = 7,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 8,
|
||||
Pos = 8,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 9,
|
||||
Pos = 9,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 10,
|
||||
Pos = 10,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 11,
|
||||
Pos = 11,
|
||||
Type = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 12,
|
||||
Pos = 12,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 13,
|
||||
Pos = 13,
|
||||
Type = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 14,
|
||||
Pos = 14,
|
||||
Type = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Flasche", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -72,9 +180,6 @@ namespace CocktailWeb.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("Pos")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Flaschen", (string)null);
|
||||
@ -111,6 +216,15 @@ namespace CocktailWeb.Migrations
|
||||
b.Navigation("Flasche");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Filler", b =>
|
||||
{
|
||||
b.HasOne("CocktailWeb.Data.Flasche", "Flasche")
|
||||
.WithMany()
|
||||
.HasForeignKey("FlascheId");
|
||||
|
||||
b.Navigation("Flasche");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CocktailWeb.Data.Cocktail", b =>
|
||||
{
|
||||
b.Navigation("Cocktailflaschen");
|
||||
|
||||
@ -1,16 +1,46 @@
|
||||
@page "/cocktails/{CocktailId}"
|
||||
@using CocktailWeb.Data
|
||||
@using Microsoft.AspNetCore.Components.Sections
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@inject IDbContextFactory<DbDataContext> DataContextFactory;
|
||||
|
||||
@if(SelectedCocktail != null)
|
||||
{
|
||||
<h3>@SelectedCocktail.Name</h3>
|
||||
|
||||
} else
|
||||
{
|
||||
<h3>Cocktail konnte nicht gefunden werden</h3>
|
||||
<SectionContent SectionId="TopRow.Title">
|
||||
<a class="btn btn-primary" href="/cocktails">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-circle" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8m15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-4.5-.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5z" />
|
||||
</svg>
|
||||
Zurück
|
||||
</a>
|
||||
</SectionContent>
|
||||
|
||||
@if (SelectedCocktail == null)
|
||||
{
|
||||
<h3>Cocktail konnte nicht gefunden werden</h3>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card mb-3" style="max-width: 540px;">
|
||||
<div class="row g-0">
|
||||
<div class="col-md-4">
|
||||
<img src="@SelectedCocktail.ImageURL" class="img-fluid rounded-start" alt="...">
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">@SelectedCocktail.Name</h5>
|
||||
<p class="card-text">
|
||||
<h6>Zutaten:</h6>
|
||||
<ul>
|
||||
@foreach (var Zutat in SelectedCocktail.Cocktailflaschen)
|
||||
{
|
||||
<li>@Zutat.Flasche?.Name (@Zutat.Menge ml)</li>
|
||||
}
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +58,7 @@
|
||||
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
|
||||
if (_DataContext != null)
|
||||
{
|
||||
SelectedCocktail = _DataContext.Cocktails.FirstOrDefault(c => c.Id == id);
|
||||
SelectedCocktail = _DataContext.Cocktails.Include(c => c.Cocktailflaschen).ThenInclude(cf => cf.Flasche).Single(c => c.Id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +1,14 @@
|
||||
@page "/cocktails"
|
||||
@page "/"
|
||||
@using CocktailWeb.Data
|
||||
@using Microsoft.AspNetCore.Components.Sections
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@inject IDbContextFactory<DbDataContext> DataContextFactory;
|
||||
@inject IWebHostEnvironment env;
|
||||
<!--layout SideScrollLayout-->
|
||||
<!--<h3>Cocktails</h3>-->
|
||||
|
||||
<PageTitle>Cocktails</PageTitle>
|
||||
<SectionContent SectionId="TopRow.Title">
|
||||
<label>Cocktails</label>
|
||||
</SectionContent>
|
||||
<!--
|
||||
<p>
|
||||
<a href="/cocktails/add">Cocktail hinzufügen</a>
|
||||
</p>
|
||||
-->
|
||||
<!-- Flex Container für Horizontalen Scroll - klappt aber nicht so richtig->
|
||||
<!--<div class="container py-2 border border-5 overflow-auto d-inline-block">
|
||||
<div class="row flex-nowrap">-->
|
||||
|
||||
<div class="card-group gap-3 flex-nowrap">
|
||||
@foreach (Cocktail c in CocktailListe)
|
||||
@ -47,3 +38,5 @@
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@page "/"
|
||||
@page "/index"
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
|
||||
Welcome to your new app.
|
||||
|
||||
<a href="/cocktails">
|
||||
Cocktails</a>
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
@page "/serialtest"
|
||||
@using System.IO.Ports
|
||||
@using Microsoft.Extensions.Options
|
||||
@inject IOptions<GeneralSettings> Config;
|
||||
|
||||
<PageTitle>Serial Test</PageTitle>
|
||||
|
||||
<label for="portname">Port:</label>
|
||||
<InputText id="portname" @bind-Value="portname"></InputText>
|
||||
<label for="inputdata">Data:</label>
|
||||
<InputText id="inputdata" @bind-Value="inputdata"></InputText>
|
||||
<button @onclick="SendData">Send</button>
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
@code {
|
||||
SerialPort? port;
|
||||
string? portname = "COM5";
|
||||
string? receivedText;
|
||||
string? inputdata ="LED";
|
||||
|
||||
@ -24,15 +23,14 @@
|
||||
|
||||
bool Sending = false;
|
||||
bool Receiving = false;
|
||||
|
||||
public async Task SendData()
|
||||
{
|
||||
if (Sending) return; // nichts senden, wenn bereits am Senden
|
||||
Sending = true;
|
||||
if (port == null && portname != null)
|
||||
if (port == null && Config.Value.SerialPort != null)
|
||||
{
|
||||
port = new SerialPort(portname);
|
||||
port.BaudRate = 115200; //9600
|
||||
port = new SerialPort(Config.Value.SerialPort);
|
||||
port.BaudRate = Config.Value.Baudrate; //9600
|
||||
port.DataReceived += port_DataReceived;
|
||||
//port.DataBits = 8;
|
||||
//port.StopBits = StopBits.One;
|
||||
|
||||
@ -1,10 +1,17 @@
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using Microsoft.AspNetCore.Components.Sections
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using CocktailWeb.Data
|
||||
@page "/cocktails/add"
|
||||
@using Microsoft.Extensions.Options
|
||||
@page "/settings/cocktails/edit"
|
||||
@page "/settings/cocktails/edit/{id}"
|
||||
@inject IDbContextFactory<DbDataContext> DataContextFactory;
|
||||
@inject NavigationManager nav;
|
||||
@inject IWebHostEnvironment env;
|
||||
<h3>Cocktail hinzufügen</h3>
|
||||
@inject IOptions<GeneralSettings> Config;
|
||||
|
||||
<SectionContent SectionId="TopRow.Title">
|
||||
<label>Cocktail hinzufügen</label>
|
||||
</SectionContent>
|
||||
|
||||
|
||||
<div class="d-flex gap-3">
|
||||
@ -69,7 +76,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<button @onclick="OnSubmit" class="btn btn-primary">Speichern</button>
|
||||
<button @onclick="@(() => nav.NavigateTo("/cocktails"))" class="btn btn-secondary">Abbrechen</button>
|
||||
<button @onclick="@(() => nav.NavigateTo("/settings/cocktails"))" class="btn btn-secondary">Abbrechen</button>
|
||||
</div>
|
||||
|
||||
<div class="border border-2 rounded p-3 w-100">
|
||||
@ -1,28 +1,40 @@
|
||||
using CocktailWeb;
|
||||
using CocktailWeb.Data;
|
||||
using CocktailWeb.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CocktailWeb.Pages
|
||||
namespace CocktailWeb.Pages.Settings
|
||||
{
|
||||
public partial class CocktailHinzufuegen
|
||||
{
|
||||
[Parameter]
|
||||
public string? id { get; set; }
|
||||
public List<Flasche> FlaschenListe { get; set; } = new();
|
||||
|
||||
public Cocktail EditCocktail = new();
|
||||
public Cocktail? EditCocktail;
|
||||
|
||||
private IBrowserFile? CocktaiLBildDatei;
|
||||
private DbDataContext? _DataContext;
|
||||
|
||||
private int MaxAllowedUploadSizeInMB = 10;
|
||||
|
||||
private string ImageUploadDir = "cocktails";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (id != null)
|
||||
{
|
||||
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
|
||||
if (_DataContext != null)
|
||||
{
|
||||
EditCocktail = _DataContext.Cocktails.Include(c => c.Cocktailflaschen).ThenInclude(cf => cf.Flasche).Single(c => c.Id == Convert.ToInt32(id));
|
||||
}
|
||||
}
|
||||
// Falls keine ID angegeben wurde oder der Cocktail in der Datenbank nicht gefunden wurde, gehen wir davon aus dass ein neuer Cocktail erstellt wird.
|
||||
if (EditCocktail == null)
|
||||
{
|
||||
EditCocktail = new();
|
||||
}
|
||||
|
||||
await FillFlaschenListe();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
public async Task FillFlaschenListe()
|
||||
@ -36,13 +48,13 @@ namespace CocktailWeb.Pages
|
||||
|
||||
public void FlascheHinzufuegen(MouseEventArgs e, Flasche f)
|
||||
{
|
||||
EditCocktail.Cocktailflaschen.Add(new CocktailFlasche() { Flasche = f, Reihenfolge = EditCocktail.Cocktailflaschen.Count + 1 });
|
||||
EditCocktail?.Cocktailflaschen.Add(new CocktailFlasche() { Flasche = f, Reihenfolge = EditCocktail.Cocktailflaschen.Count + 1 });
|
||||
CocktailFlaschenSortieren();
|
||||
}
|
||||
|
||||
public void FlascheEntfernen(MouseEventArgs e, CocktailFlasche cf)
|
||||
{
|
||||
EditCocktail.Cocktailflaschen.Remove(cf);
|
||||
EditCocktail?.Cocktailflaschen.Remove(cf);
|
||||
CocktailFlaschenSortieren();
|
||||
}
|
||||
|
||||
@ -85,12 +97,12 @@ namespace CocktailWeb.Pages
|
||||
try
|
||||
{
|
||||
// Bild hochladen
|
||||
var relativeuploadpath = Path.Join(ImageUploadDir, $"{EditCocktail.Id}{Path.GetExtension(CocktaiLBildDatei.Name)}");
|
||||
var relativeuploadpath = Path.Join(Config.Value.ImageUploadDir, $"{EditCocktail.Id}{Path.GetExtension(CocktaiLBildDatei.Name)}");
|
||||
var fullpath = Path.Join(env.WebRootPath, relativeuploadpath);
|
||||
string? folder = Path.GetDirectoryName(fullpath);
|
||||
if (folder != null && !Path.Exists(folder)) Directory.CreateDirectory(folder);
|
||||
|
||||
Stream stream = CocktaiLBildDatei.OpenReadStream(maxAllowedSize: MaxAllowedUploadSizeInMB * 1024 * 1024);
|
||||
Stream stream = CocktaiLBildDatei.OpenReadStream(maxAllowedSize: Config.Value.MaxAllowedUploadSizeInMB * 1024 * 1024);
|
||||
FileStream fs = File.Create(fullpath);
|
||||
await stream.CopyToAsync(fs);
|
||||
stream.Close();
|
||||
30
CocktailWeb/Pages/Settings/Cocktails.razor
Normal file
30
CocktailWeb/Pages/Settings/Cocktails.razor
Normal file
@ -0,0 +1,30 @@
|
||||
@page "/settings/cocktails"
|
||||
@using CocktailWeb.Data
|
||||
@using Microsoft.AspNetCore.Components.Sections
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@inject IDbContextFactory<DbDataContext> DataContextFactory;
|
||||
@inject IWebHostEnvironment env;
|
||||
<!--layout SideScrollLayout-->
|
||||
<!--<h3>Cocktails</h3>-->
|
||||
|
||||
<SectionContent SectionId="TopRow.Title">
|
||||
<label>Einstellungen - Cocktails</label>
|
||||
</SectionContent>
|
||||
|
||||
<a class="btn btn-primary mb-3" href="/settings/cocktails/edit">Cocktail hinzufügen</a>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-bordered table-light border-dark">
|
||||
<tbody>
|
||||
@foreach (Cocktail c in CocktailListe)
|
||||
{
|
||||
<tr>
|
||||
<td class="p-0"><img src="@c.ImageURL" style="max-height:40px;" /></td>
|
||||
<td>@c.Name</td>
|
||||
<td> <a class="btn btn-primary" href="/settings/cocktails/edit/@c.Id">Bearbeiten</a></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
30
CocktailWeb/Pages/Settings/Cocktails.razor.cs
Normal file
30
CocktailWeb/Pages/Settings/Cocktails.razor.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using CocktailWeb;
|
||||
using CocktailWeb.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CocktailWeb.Pages.Settings
|
||||
{
|
||||
public partial class Cocktails
|
||||
{
|
||||
private DbDataContext? _DataContext;
|
||||
|
||||
private List<Cocktail> CocktailListe { get; set; } = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ShowCocktails();
|
||||
}
|
||||
|
||||
private async Task ShowCocktails()
|
||||
{
|
||||
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
|
||||
if (_DataContext != null)
|
||||
{
|
||||
CocktailListe = await _DataContext.Cocktails.OrderBy(f => f.Name).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,16 @@
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using Microsoft.AspNetCore.Components.Sections
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using CocktailWeb.Data
|
||||
@page "/flaschen"
|
||||
@page "/settings/flaschen"
|
||||
@inject IDbContextFactory<DbDataContext> FlascheDataContextFactory;
|
||||
|
||||
<PageTitle>Flaschen</PageTitle>
|
||||
|
||||
<SectionContent SectionId="TopRow.Title">
|
||||
<label>Einstellungen - Zutaten</label>
|
||||
</SectionContent>
|
||||
|
||||
|
||||
@if (CreateFormVisible && FlascheToCreate != null)
|
||||
{
|
||||
<h3>Flasche hinzufügen</h3>
|
||||
@ -16,7 +22,7 @@
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="offset-4 col-8">
|
||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="CreateNewFlasche">Submit</button>
|
||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="CreateNewFlasche">Hinzufügen</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@ -29,15 +35,13 @@ else
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
<h3>Flaschen</h3>
|
||||
@if (FlaschenListe != null && FlaschenListe.Count > 0)
|
||||
{
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-bordered table-light border-dark">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">ID</th>
|
||||
<!--<th scope="col">ID</th>-->
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
@ -48,19 +52,19 @@ else
|
||||
@if (EditFormVisible && FlascheToUpdate != null && FlascheToUpdate.Id == flasche.Id)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@FlascheToUpdate.Id</th>
|
||||
<!-- <th scope="row">@FlascheToUpdate.Id</th>-->
|
||||
<td> <input id="Name" name="Name" type="text" class="form-control" @bind="@FlascheToUpdate.Name" /></td>
|
||||
<td><button name="submit" type="submit" class="btn btn-primary" @onclick="() => UpdateEmployee(FlascheToUpdate)">Save</button></td>
|
||||
<td><button name="submit" type="submit" class="btn btn-primary" @onclick="() => UpdateEmployee(FlascheToUpdate)">Speichern</button></td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@flasche.Id</th>
|
||||
<!-- <th scope="row">@flasche.Id</th> -->
|
||||
<td>@flasche.Name</td>
|
||||
<td>
|
||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="() => ShowEditForm(flasche)">Edit</button>
|
||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="() => DeleteFlasche(flasche)">Delete</button>
|
||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="() => ShowEditForm(flasche)">Bearbeiten</button>
|
||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="() => DeleteFlasche(flasche)">Löschen</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using CocktailWeb.Data;
|
||||
|
||||
namespace CocktailWeb.Pages
|
||||
namespace CocktailWeb.Pages.Settings
|
||||
{
|
||||
public partial class Flaschen
|
||||
{
|
||||
13
CocktailWeb/Pages/Settings/Maschine.razor
Normal file
13
CocktailWeb/Pages/Settings/Maschine.razor
Normal file
@ -0,0 +1,13 @@
|
||||
@page "/settings/maschine";
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using CocktailWeb.Data
|
||||
@using Microsoft.AspNetCore.Components.Sections
|
||||
@inject IDbContextFactory<DbDataContext> FlascheDataContextFactory;
|
||||
<PageTitle>Maschine</PageTitle>
|
||||
|
||||
<SectionContent SectionId="TopRow.Title">
|
||||
<label>Einstellungen - Maschine</label>
|
||||
</SectionContent>
|
||||
|
||||
|
||||
|
||||
6
CocktailWeb/Pages/Settings/Maschine.razor.cs
Normal file
6
CocktailWeb/Pages/Settings/Maschine.razor.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace CocktailWeb.Pages.Settings
|
||||
{
|
||||
partial class Maschine
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
using CocktailWeb;
|
||||
using CocktailWeb.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
@ -11,6 +12,7 @@ var connectionString = builder.Configuration.GetConnectionString("CocktailDB");
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddDbContextFactory<DbDataContext>(options => options.UseSqlite(connectionString));
|
||||
builder.Services.Configure<GeneralSettings>(builder.Configuration.GetSection(nameof(GeneralSettings)));
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
@ -2,9 +2,17 @@
|
||||
|
||||
|
||||
<div class="d-flex fixed-top justify-content-between px-4" style="background-color: #f7f7f7; border-bottom: 1px solid #d6d5d5; height: 56px; align-items: center; top: 0; z-index: 1;">
|
||||
<div class="d-flex gap-3">
|
||||
<a class="btn btn-primary" href="/">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-house" viewBox="0 0 16 16">
|
||||
<path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z" />
|
||||
</svg>
|
||||
</a>
|
||||
<h3>
|
||||
<SectionOutlet SectionId="Title" />
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="dropdown show">
|
||||
<a class="btn btn-secondary dropdown-toggle" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear-fill" viewBox="0 0 16 16">
|
||||
@ -13,8 +21,9 @@
|
||||
Einstellungen
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuLink">
|
||||
<a class="dropdown-item" href="/flaschen">Zutaten</a>
|
||||
<a class="dropdown-item" href="/cocktails">Cocktails</a>
|
||||
<a class="dropdown-item" href="/settings/maschine">Maschine</a>
|
||||
<a class="dropdown-item" href="/settings/flaschen">Zutaten</a>
|
||||
<a class="dropdown-item" href="/settings/cocktails">Cocktails</a>
|
||||
<a class="dropdown-item" href="/serialtest">Serial Test</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -8,3 +8,4 @@
|
||||
@using Microsoft.JSInterop
|
||||
@using CocktailWeb
|
||||
@using CocktailWeb.Shared
|
||||
@using CocktailWeb.Pages
|
||||
|
||||
@ -8,5 +8,11 @@
|
||||
"ConnectionStrings": {
|
||||
"CocktailDB": "Data Source=Data\\cocktails.db"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"GeneralSettings": {
|
||||
"MaxAllowedUploadSizeInMB": 10,
|
||||
"ImageUploadDir": "images",
|
||||
"SerialPort": "COM5",
|
||||
"Baudrate": 115200
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user