first edit

This commit is contained in:
Курнат Андрей
2026-01-31 16:11:36 +03:00
commit f0e11d6379
148 changed files with 6986 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class SpnmtpViewModel:ViewModelBase
{
#region Constructor
public SpnmtpViewModel(ILimsService limsService, Spnmtp spnmtp = null)
{
_limsService = limsService;
if (spnmtp != null) _spnmtp = spnmtp;
else _spnmtp = new Spnmtp();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly Spnmtp _spnmtp;
#endregion //Fields
#region Properties
public string? Nmtp
{
get => _spnmtp.Nmtp;
set { _spnmtp.Nmtp = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
private async Task SaveAsync()
{
if (_spnmtp.Id == 0) await _limsService.Spnmtps.AddAsync(_spnmtp);
else await _limsService.Spnmtps.UpdateAsync(_spnmtp);
}
public async Task Remove()
{
await _limsService.Spnmtps.RemoveAsync(_spnmtp);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}