diff --git a/src/Modules/SimplCommerce.Module.Cms/Controllers/CarouselWidgetApiController.cs b/src/Modules/SimplCommerce.Module.Cms/Controllers/CarouselWidgetApiController.cs index d261bb581f..c566d14bf1 100644 --- a/src/Modules/SimplCommerce.Module.Cms/Controllers/CarouselWidgetApiController.cs +++ b/src/Modules/SimplCommerce.Module.Cms/Controllers/CarouselWidgetApiController.cs @@ -129,7 +129,8 @@ private CarouselWidgetForm ToCarouselWidgetFormModel(IFormCollection formCollect var model = new CarouselWidgetForm(); model.Name = formCollection["name"]; model.WidgetZoneId = int.Parse(formCollection["widgetZoneId"]); - model.DisplayOrder = int.Parse(formCollection["displayOrder"]); + int.TryParse(formCollection["displayOrder"], out int displayOrder); + model.DisplayOrder = displayOrder; if (DateTimeOffset.TryParse(formCollection["publishStart"], out DateTimeOffset publishStart)) { model.PublishStart = publishStart; diff --git a/src/Modules/SimplCommerce.Module.Cms/Controllers/SpaceBarWidgetApiContorller.cs b/src/Modules/SimplCommerce.Module.Cms/Controllers/SpaceBarWidgetApiContorller.cs index 03f7c9381b..266505f1d7 100644 --- a/src/Modules/SimplCommerce.Module.Cms/Controllers/SpaceBarWidgetApiContorller.cs +++ b/src/Modules/SimplCommerce.Module.Cms/Controllers/SpaceBarWidgetApiContorller.cs @@ -66,7 +66,10 @@ public async Task Post(IFormCollection formCollection) { foreach (var item in model.Items) { - item.Image = await SaveFile(item.UploadImage); + if(item.UploadImage != null) + { + item.Image = await SaveFile(item.UploadImage); + } } var widgetInstance = new WidgetInstance @@ -126,7 +129,8 @@ private SpaceBarWidgetForm ToSpaceBarWidgetFormModel(IFormCollection formCollect var model = new SpaceBarWidgetForm(); model.Name = formCollection["name"]; model.WidgetZoneId = int.Parse(formCollection["widgetZoneId"]); - model.DisplayOrder = int.Parse(formCollection["displayOrder"]); + int.TryParse(formCollection["displayOrder"], out int displayOrder); + model.DisplayOrder = displayOrder; if (DateTimeOffset.TryParse(formCollection["publishStart"], out DateTimeOffset publishStart)) { model.PublishStart = publishStart;