Ohne Syncfusion
This commit is contained in:
38
SewerStammGen/Commands/HaltungEditSaveCommand.cs
Normal file
38
SewerStammGen/Commands/HaltungEditSaveCommand.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.WPF.ViewModel;
|
||||
using Shared.Contracts;
|
||||
using Shared.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.WPF.Commands
|
||||
{
|
||||
internal class HaltungEditSaveCommand : AsyncCommandBase
|
||||
{
|
||||
private HaltungEditViewModel haltungEditViewModel;
|
||||
private IDataService<Kanal> kanalDataService;
|
||||
private ISchachtService schachtService;
|
||||
|
||||
public HaltungEditSaveCommand(HaltungEditViewModel haltungEditViewModel, IDataService<Kanal> kanalDataService, ISchachtService schachtService)
|
||||
{
|
||||
this.haltungEditViewModel = haltungEditViewModel;
|
||||
this.kanalDataService = kanalDataService;
|
||||
this.schachtService = schachtService;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
if(haltungEditViewModel._oberePunkt != haltungEditViewModel.Model.StartSchacht.Objektbezeichnung)
|
||||
{
|
||||
Schacht s = await schachtService.FindSchachtByNameAndProjektID(haltungEditViewModel._oberePunkt, haltungEditViewModel.Model.Projekt.Id);
|
||||
haltungEditViewModel.Model.StartSchacht = s;
|
||||
}
|
||||
haltungEditViewModel.Model = await kanalDataService.Update(haltungEditViewModel.Model.Id, haltungEditViewModel.Model);
|
||||
Trace.WriteLine("Daten gespeichert");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user