优化了添加设备时,并添加和更新菜单栏

This commit is contained in:
2025-06-26 22:40:20 +08:00
parent 244b67391d
commit a04bfc2010
8 changed files with 63 additions and 155 deletions

View File

@@ -17,7 +17,8 @@ public class DeviceRepository
public async Task<bool> Add(Device device)
{
var exist = await _db.Queryable<DbDevice>().Where(d => d.Name == device.Name).FirstAsync();
if (exist != null) throw new DbExistException("设备名称已经存在。");
if (exist != null)
throw new InvalidOperationException("设备名称已经存在。");
var dbDevice = new DbDevice();
device.CopyTo(dbDevice);
dbDevice.VariableTables = new List<DbVariableTable>();