From 4223b3e2253a63e5f98382aa1af5783ad8ca8744 Mon Sep 17 00:00:00 2001 From: salim ben ahben <40862545+Sben65@users.noreply.github.com> Date: Tue, 1 Feb 2022 10:38:39 +0100 Subject: [PATCH] fix #149 (#153) --- .../Client/Pages/DeviceModels/CreateDeviceModelPage.razor | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor index dcfcc9bc4..b0dd9b7ab 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor @@ -178,7 +178,12 @@ private void AddCommand() { - DeviceModel.Commands.Add(new DeviceModelCommand()); + var last = DeviceModel.Commands.LastOrDefault(); + + if (DeviceModel.Commands.Count == 0 || (last.Name is not null && last.Frame is not null) ) + { + DeviceModel.Commands.Add(new DeviceModelCommand()); + } } private void DeleteCommand(DeviceModelCommand item)