WIP dependency Injection
This commit is contained in:
36
DaSaSo.ViewModel/ClientEditViewModel.cs
Normal file
36
DaSaSo.ViewModel/ClientEditViewModel.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using DaSaSo.Domain.Service;
|
||||
using Microsoft.Toolkit.Mvvm.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.ViewModel
|
||||
{
|
||||
public class ClientEditViewModel : BaseViewModel
|
||||
{
|
||||
private Client _model;
|
||||
private IDataService<Client> _dataService;
|
||||
|
||||
public Client Model { get => _model; set => _model = value; }
|
||||
|
||||
public IRelayCommand SaveClientCommand { get; set; }
|
||||
|
||||
|
||||
public ClientEditViewModel(IDataService<Client> dataService, Client model)
|
||||
{
|
||||
this._model = model;
|
||||
this._dataService = dataService;
|
||||
SaveClientCommand = new RelayCommand(SaveClient);
|
||||
}
|
||||
|
||||
private void SaveClient()
|
||||
{
|
||||
_dataService.Update(Model.Id, Model);
|
||||
Mediator.Notify(Enums.EMediator.SHOWCLIENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user