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 BookViewModel:ViewModelBase
{
#region Constructor
public BookViewModel(ILimsService limsService,BookSet bookSet=null)
{
_limsService = limsService;
if (bookSet != null) _bookSet = bookSet;
else _bookSet = new BookSet();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly BookSet _bookSet;
#endregion //Fields
#region Properties
public string? Number
{
get => _bookSet.Number;
set { _bookSet.Number = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
private async Task SaveAsync()
{
if (_bookSet.Id == 0) await _limsService.Books.AddAsync(_bookSet);
else await _limsService.Books.UpdateAsync(_bookSet);
}
public async Task Remove()
{
await _limsService.Books.RemoveAsync(_bookSet);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}