You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.1 KiB
C#

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Repository;
using SlnMesnac.Repository.service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* SlnMesnac.WPF.ViewModel
* b5cb5a41-5885-475f-b182-9ea83f983978
*
* WenJY
*
* 2024-11-08 15:57:46
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.WPF.ViewModel
{
public partial class CabinetUpdateViewModel : ObservableObject
{
private readonly Ibase_cabinet_infoServices _ibase_cabinet_infoServices;
public Action CloseAction { get; set; }
public CabinetUpdateViewModel(base_cabinet_info cabinet_Info)
{
CabinetInfo = cabinet_Info;
_ibase_cabinet_infoServices = App.ServiceProvider.GetService<Ibase_cabinet_infoServices>();
}
public base_cabinet_info _cabinetInfo = null;
public base_cabinet_info CabinetInfo
{
get => _cabinetInfo;
set => SetProperty(ref _cabinetInfo, value);
}
[RelayCommand]
private void SaveCabinetInfo()
{
if (_cabinetInfo != null)
{
if (_ibase_cabinet_infoServices.Update(_cabinetInfo))
{
MessageBox.Show($"电柜信息保存成功");
CloseAction?.Invoke();
}
else
{
MessageBox.Show($"电柜信息保存失败");
}
}
}
}
}