File tree 2 files changed +8
-3
lines changed
src/Modules/SimplCommerce.Module.Cms/Controllers
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,8 @@ private CarouselWidgetForm ToCarouselWidgetFormModel(IFormCollection formCollect
129
129
var model = new CarouselWidgetForm ( ) ;
130
130
model . Name = formCollection [ "name" ] ;
131
131
model . WidgetZoneId = int . Parse ( formCollection [ "widgetZoneId" ] ) ;
132
- model . DisplayOrder = int . Parse ( formCollection [ "displayOrder" ] ) ;
132
+ int . TryParse ( formCollection [ "displayOrder" ] , out int displayOrder ) ;
133
+ model . DisplayOrder = displayOrder ;
133
134
if ( DateTimeOffset . TryParse ( formCollection [ "publishStart" ] , out DateTimeOffset publishStart ) )
134
135
{
135
136
model . PublishStart = publishStart ;
Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ public async Task<IActionResult> Post(IFormCollection formCollection)
66
66
{
67
67
foreach ( var item in model . Items )
68
68
{
69
- item . Image = await SaveFile ( item . UploadImage ) ;
69
+ if ( item . UploadImage != null )
70
+ {
71
+ item . Image = await SaveFile ( item . UploadImage ) ;
72
+ }
70
73
}
71
74
72
75
var widgetInstance = new WidgetInstance
@@ -126,7 +129,8 @@ private SpaceBarWidgetForm ToSpaceBarWidgetFormModel(IFormCollection formCollect
126
129
var model = new SpaceBarWidgetForm ( ) ;
127
130
model . Name = formCollection [ "name" ] ;
128
131
model . WidgetZoneId = int . Parse ( formCollection [ "widgetZoneId" ] ) ;
129
- model . DisplayOrder = int . Parse ( formCollection [ "displayOrder" ] ) ;
132
+ int . TryParse ( formCollection [ "displayOrder" ] , out int displayOrder ) ;
133
+ model . DisplayOrder = displayOrder ;
130
134
if ( DateTimeOffset . TryParse ( formCollection [ "publishStart" ] , out DateTimeOffset publishStart ) )
131
135
{
132
136
model . PublishStart = publishStart ;
You can’t perform that action at this time.
0 commit comments