39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
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, 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");
|
|
}
|
|
}
|
|
}
|