Flaschen bearbeiten auf Extra Form gepackt
This commit is contained in:
parent
ccb0404477
commit
7ee75d0de3
@ -1,73 +0,0 @@
|
|||||||
@using Microsoft.AspNetCore.Components.Sections
|
|
||||||
@using Microsoft.EntityFrameworkCore
|
|
||||||
@using CocktailWeb.Data
|
|
||||||
@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>
|
|
||||||
<div class="row">
|
|
||||||
<label for="Name" class="col-4 col-form-label">Name</label>
|
|
||||||
<div class="col-8">
|
|
||||||
<input id="Name" name="Name" type="text" class="form-control" @bind="@FlascheToCreate.Name" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<div class="offset-4 col-8">
|
|
||||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="CreateNewFlasche">Hinzufügen</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="ShowCreateForm">Flasche hinzufügen</button>
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (FlaschenListe != null && FlaschenListe.Count > 0)
|
|
||||||
{
|
|
||||||
<div class="table-responsive mt-3">
|
|
||||||
<table class="table table-striped table-hover table-bordered table-dark border-dark">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">Name</th>
|
|
||||||
<th style="text-align:right;" scope="col">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var flasche in FlaschenListe)
|
|
||||||
{
|
|
||||||
@if (EditFormVisible && FlascheToUpdate != null && FlascheToUpdate.Id == flasche.Id)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<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)">Speichern</button></td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>@flasche.Name</td>
|
|
||||||
<td style="text-align:right;">
|
|
||||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="() => ShowEditForm(flasche)">Bearbeiten</button>
|
|
||||||
<button name="submit" type="submit" class="btn btn-outline-danger" @onclick="() => DeleteFlasche(flasche)">Löschen</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,84 +0,0 @@
|
|||||||
using SQLitePCL;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using CocktailWeb.Data;
|
|
||||||
|
|
||||||
namespace CocktailWeb.Pages.Settings
|
|
||||||
{
|
|
||||||
public partial class Flaschen
|
|
||||||
{
|
|
||||||
public bool CreateFormVisible { get; set; }
|
|
||||||
public bool EditFormVisible { get; set; }
|
|
||||||
|
|
||||||
public Flasche? FlascheToCreate { get; set; }
|
|
||||||
public Flasche? FlascheToUpdate { get; set; }
|
|
||||||
|
|
||||||
public List<Flasche>? FlaschenListe { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private DbDataContext? _DataContext;
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
CreateFormVisible = false;
|
|
||||||
await ShowFlaschen();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowCreateForm()
|
|
||||||
{
|
|
||||||
FlascheToCreate = new Flasche();
|
|
||||||
CreateFormVisible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task CreateNewFlasche()
|
|
||||||
{
|
|
||||||
_DataContext ??= await FlascheDataContextFactory.CreateDbContextAsync();
|
|
||||||
|
|
||||||
if (FlascheToCreate != null && _DataContext != null)
|
|
||||||
{
|
|
||||||
_DataContext.Flaschen.Add(FlascheToCreate);
|
|
||||||
await _DataContext.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
CreateFormVisible = false;
|
|
||||||
await ShowFlaschen();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task ShowFlaschen()
|
|
||||||
{
|
|
||||||
_DataContext ??= await FlascheDataContextFactory.CreateDbContextAsync();
|
|
||||||
if (_DataContext != null)
|
|
||||||
{
|
|
||||||
FlaschenListe = await _DataContext.Flaschen.OrderBy(f => f.Name).ToListAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task ShowEditForm(Flasche flasche)
|
|
||||||
{
|
|
||||||
_DataContext ??= await FlascheDataContextFactory.CreateDbContextAsync();
|
|
||||||
FlascheToUpdate = _DataContext.Flaschen.FirstOrDefault(f => f.Id == flasche.Id);
|
|
||||||
EditFormVisible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task UpdateEmployee(Flasche flasche)
|
|
||||||
{
|
|
||||||
_DataContext ??= await FlascheDataContextFactory.CreateDbContextAsync();
|
|
||||||
if (_DataContext != null && flasche != null)
|
|
||||||
{
|
|
||||||
_DataContext.Flaschen.Update(flasche);
|
|
||||||
await _DataContext.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
EditFormVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task DeleteFlasche(Flasche flasche)
|
|
||||||
{
|
|
||||||
_DataContext ??= await FlascheDataContextFactory.CreateDbContextAsync();
|
|
||||||
if (_DataContext != null && flasche != null)
|
|
||||||
{
|
|
||||||
_DataContext.Flaschen.Remove(flasche);
|
|
||||||
await _DataContext.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
await ShowFlaschen();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
127
CocktailWeb/Pages/Settings/IngredientEdit.razor
Normal file
127
CocktailWeb/Pages/Settings/IngredientEdit.razor
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
@page "/settings/ingredients/edit"
|
||||||
|
@page "/settings/ingredients/edit/{id}"
|
||||||
|
@using CocktailWeb.Data
|
||||||
|
@using Microsoft.AspNetCore.Components.Sections
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
|
@using Microsoft.Extensions.Options
|
||||||
|
@inject IDbContextFactory<DbDataContext> DataContextFactory;
|
||||||
|
@inject NavigationManager nav;
|
||||||
|
@inject IWebHostEnvironment env;
|
||||||
|
@inject IOptions<GeneralSettings> Config;
|
||||||
|
|
||||||
|
<SectionContent SectionId="TopRow.Title">
|
||||||
|
<label>Zutat bearbeiten</label>
|
||||||
|
</SectionContent>
|
||||||
|
|
||||||
|
<div class="d-flex gap-3">
|
||||||
|
<div class="border border-2 rounded p-3 w-100">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="name">Name</label>
|
||||||
|
<input id="cocktailname" name="name" type="text" class="form-control" @bind="@curFlasche.Name" />
|
||||||
|
</div>
|
||||||
|
<div class="form-check mb-3">
|
||||||
|
<InputCheckbox class="form-check-input" id="IsAlcoholic" @bind-Value=@curFlasche.Alkoholisch>Alkoholisch</InputCheckbox>
|
||||||
|
<label class="form-check-label" for="IsAlcoholic">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-stars text-success" viewBox="0 0 16 16">
|
||||||
|
<path d="M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.73 1.73 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.73 1.73 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.73 1.73 0 0 0 3.407 2.31zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.16 1.16 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.16 1.16 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732z" />
|
||||||
|
</svg>
|
||||||
|
Alkoholisch
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<button @onclick="OnSubmit" class="btn btn-primary">Speichern</button>
|
||||||
|
<button @onclick="@(() => nav.NavigateTo("/settings/ingredients"))" class="btn btn-secondary">Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
<div class="border border-2 rounded p-3 w-100">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="image">Bild</label>
|
||||||
|
<div class="mb-2">
|
||||||
|
@if (curFlasche.ImageURL != null)
|
||||||
|
{
|
||||||
|
<img style="max-width:128px;" src="@curFlasche.ImageURL" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div>Kein Bild vorhanden</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<label class="form-label" for="image">Neues Bild hochladen</label>
|
||||||
|
<InputFile OnChange="Bild_OnChange" class="form-control" id="image" name="image" accept=".jpg,.png,.jpeg,.gif,.webp" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public string? id { get; set; }
|
||||||
|
|
||||||
|
public Flasche curFlasche = null!;
|
||||||
|
|
||||||
|
public IBrowserFile? NewImage;
|
||||||
|
|
||||||
|
private DbDataContext? _DataContext;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
if (id != null)
|
||||||
|
{
|
||||||
|
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
|
||||||
|
if (_DataContext != null) curFlasche = _DataContext.Flaschen.Single(f => f.Id == Convert.ToInt32(id));
|
||||||
|
}
|
||||||
|
// Falls keine ID angegeben wurde oder der Eintrag in der Datenbank nicht gefunden wurde, gehen wir davon aus dass ein neuer Eintrag erstellt wird.
|
||||||
|
if (curFlasche == null) curFlasche = new();
|
||||||
|
|
||||||
|
//await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Bild_OnChange(InputFileChangeEventArgs e)
|
||||||
|
{
|
||||||
|
NewImage = e.GetMultipleFiles().FirstOrDefault();
|
||||||
|
//this.StateHasChanged(); War in nem Stackexchange.. Nötig?
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnSubmit(EventArgs e)
|
||||||
|
{
|
||||||
|
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
|
||||||
|
|
||||||
|
if (curFlasche != null && _DataContext != null)
|
||||||
|
{
|
||||||
|
if (id != null)
|
||||||
|
{
|
||||||
|
_DataContext.Flaschen.Update(curFlasche);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_DataContext.Flaschen.Add(curFlasche);
|
||||||
|
}
|
||||||
|
await _DataContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
if (NewImage != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Bild hochladen
|
||||||
|
var relativeuploadpath = Path.Join(Config.Value.ImageUploadDir, $"ingredient_{curFlasche.Id}{Path.GetExtension(NewImage.Name)}");
|
||||||
|
var fullpath = Path.Join(env.WebRootPath, relativeuploadpath);
|
||||||
|
string? folder = Path.GetDirectoryName(fullpath);
|
||||||
|
if (folder != null && !Path.Exists(folder)) Directory.CreateDirectory(folder);
|
||||||
|
|
||||||
|
Stream stream = NewImage.OpenReadStream(maxAllowedSize: Config.Value.MaxAllowedUploadSizeInMB * 1024 * 1024);
|
||||||
|
FileStream fs = File.Create(fullpath);
|
||||||
|
await stream.CopyToAsync(fs);
|
||||||
|
stream.Close();
|
||||||
|
fs.Close();
|
||||||
|
curFlasche.ImageURL = relativeuploadpath;
|
||||||
|
// URL hinterlegen und wieder speichern
|
||||||
|
_DataContext.Flaschen.Update(curFlasche);
|
||||||
|
await _DataContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Error uploading image: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nav.NavigateTo("/settings/ingredients");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
140
CocktailWeb/Pages/Settings/Ingredients.razor
Normal file
140
CocktailWeb/Pages/Settings/Ingredients.razor
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
@using Microsoft.AspNetCore.Components.Sections
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
|
@using CocktailWeb.Data
|
||||||
|
@page "/settings/ingredients"
|
||||||
|
@inject IDbContextFactory<DbDataContext> FlascheDataContextFactory;
|
||||||
|
|
||||||
|
<PageTitle>Zutaten</PageTitle>
|
||||||
|
|
||||||
|
<SectionContent SectionId="TopRow.Title">
|
||||||
|
<label>Einstellungen - Zutaten</label>
|
||||||
|
</SectionContent>
|
||||||
|
|
||||||
|
<a class="btn btn-primary mb-3" href="/settings/ingredients/edit">Neue Zutat</a>
|
||||||
|
|
||||||
|
@if (IngredientsList != null && IngredientsList.Count > 0)
|
||||||
|
{
|
||||||
|
<div class="table-responsive mt-3">
|
||||||
|
<table class="table table-striped table-hover table-bordered table-dark border-dark">
|
||||||
|
<tbody>
|
||||||
|
@foreach (var fl in IngredientsList)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td class="p-0" style="width:64px"><img src="@fl.ImageURL" style="max-width:100%; max-height:auto;" /></td>
|
||||||
|
<td style="vertical-align:middle;">
|
||||||
|
@fl.Name
|
||||||
|
@if (fl.Alkoholisch)
|
||||||
|
{
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-stars text-success" style="margin-left:15px;" viewBox="0 0 16 16">
|
||||||
|
<path d="M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.73 1.73 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.73 1.73 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.73 1.73 0 0 0 3.407 2.31zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.16 1.16 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.16 1.16 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732z" />
|
||||||
|
</svg>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td style="text-align:right; vertical-align:middle;">
|
||||||
|
<a class="btn btn-primary" href="/settings/ingredients/edit/@fl.Id">Bearbeiten</a>
|
||||||
|
<button name="submit" type="submit" class="btn btn-outline-danger" @onclick="() => ConfirmDelete(fl)">Löschen</button>
|
||||||
|
@*
|
||||||
|
<a class="btn btn-primary" href="/settings/cocktails/edit/@c.Id">Bearbeiten</a>
|
||||||
|
<button name="submit" type="submit" class="btn btn-outline-danger" @onclick="() => ConfirmDelete(c)">Löschen</button>
|
||||||
|
*@
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<ModalComponent @ref="dlgDelete">
|
||||||
|
<Title>Löschen bestätigen</Title>
|
||||||
|
<Body>
|
||||||
|
Willst du die Zutat wirklich löschen?<br />
|
||||||
|
Achtung, die Zutat wird auch aus den Maschineneinstellungen entfernt, falls sie dort verwendet worden sein sollte.
|
||||||
|
</Body>
|
||||||
|
<Footer>
|
||||||
|
<button class="btn btn-danger" @onclick="DeleteIngredient">Jo</button>
|
||||||
|
<button class="btn btn-primary" @onclick="() => CloseDialog(dlgDelete)">Nee</button>
|
||||||
|
</Footer>
|
||||||
|
</ModalComponent>
|
||||||
|
|
||||||
|
<ModalComponent @ref="dlgInfo">
|
||||||
|
<Title>Löschen nicht möglich</Title>
|
||||||
|
<Body>
|
||||||
|
Die Zutat kann nicht gelöscht werden, da Sie noch in Cocktails verwendet wird:<br />
|
||||||
|
@InfoText
|
||||||
|
</Body>
|
||||||
|
<Footer>
|
||||||
|
<button class="btn btn-primary" @onclick="() => CloseDialog(dlgInfo)">OK</button>
|
||||||
|
</Footer>
|
||||||
|
</ModalComponent>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
public List<Flasche>? IngredientsList { get; set; }
|
||||||
|
|
||||||
|
private DbDataContext? _DataContext;
|
||||||
|
|
||||||
|
private Flasche? SelectedIngredient;
|
||||||
|
|
||||||
|
private ModalComponent dlgDelete = null!;
|
||||||
|
private ModalComponent dlgInfo = null!;
|
||||||
|
|
||||||
|
private string InfoText;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await FillIngredientsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task FillIngredientsList()
|
||||||
|
{
|
||||||
|
_DataContext ??= await FlascheDataContextFactory.CreateDbContextAsync();
|
||||||
|
if (_DataContext != null)
|
||||||
|
{
|
||||||
|
IngredientsList = await _DataContext.Flaschen.OrderBy(f => f.Name).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ConfirmDelete(Flasche fl)
|
||||||
|
{
|
||||||
|
_DataContext ??= await FlascheDataContextFactory.CreateDbContextAsync();
|
||||||
|
if (_DataContext == null) throw new Exception("Error creating DataContext");
|
||||||
|
|
||||||
|
var CocktailsWithIngredient = _DataContext.Cocktails.Include(c => c.Cocktailflaschen).Where(cf => cf.Cocktailflaschen.Any(cff => cff.Flasche == fl)).OrderBy(c => c.Name).ToList();
|
||||||
|
|
||||||
|
if (CocktailsWithIngredient.Count > 0)
|
||||||
|
{
|
||||||
|
InfoText = String.Join(", ", CocktailsWithIngredient.Select(c => c.Name).ToArray());
|
||||||
|
await dlgInfo.OpenModal();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedIngredient = fl;
|
||||||
|
await dlgDelete.OpenModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task DeleteIngredient()
|
||||||
|
{
|
||||||
|
_DataContext ??= await FlascheDataContextFactory.CreateDbContextAsync();
|
||||||
|
if (_DataContext != null && SelectedIngredient != null)
|
||||||
|
{
|
||||||
|
// Zutat aus Maschine rausnehmen (alle Filler, die die Flasche enthalten, auf null setzen)
|
||||||
|
_DataContext.Fillers.Where(f => f.Flasche == SelectedIngredient)?.ForEachAsync(fil => fil.Flasche = null);
|
||||||
|
|
||||||
|
_DataContext.Flaschen.Remove(SelectedIngredient);
|
||||||
|
await _DataContext.SaveChangesAsync();
|
||||||
|
await FillIngredientsList();
|
||||||
|
}
|
||||||
|
await CloseDialog(dlgDelete);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task CloseDialog(ModalComponent dlg)
|
||||||
|
{
|
||||||
|
SelectedIngredient = null;
|
||||||
|
await dlg.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user