File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
src/Modules/SimplCommerce.Module.Cms/Controllers Expand file tree Collapse file tree 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
129129 var model = new CarouselWidgetForm ( ) ;
130130 model . Name = formCollection [ "name" ] ;
131131 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 ;
133134 if ( DateTimeOffset . TryParse ( formCollection [ "publishStart" ] , out DateTimeOffset publishStart ) )
134135 {
135136 model . PublishStart = publishStart ;
Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ public async Task<IActionResult> Post(IFormCollection formCollection)
6666 {
6767 foreach ( var item in model . Items )
6868 {
69- item . Image = await SaveFile ( item . UploadImage ) ;
69+ if ( item . UploadImage != null )
70+ {
71+ item . Image = await SaveFile ( item . UploadImage ) ;
72+ }
7073 }
7174
7275 var widgetInstance = new WidgetInstance
@@ -126,7 +129,8 @@ private SpaceBarWidgetForm ToSpaceBarWidgetFormModel(IFormCollection formCollect
126129 var model = new SpaceBarWidgetForm ( ) ;
127130 model . Name = formCollection [ "name" ] ;
128131 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 ;
130134 if ( DateTimeOffset . TryParse ( formCollection [ "publishStart" ] , out DateTimeOffset publishStart ) )
131135 {
132136 model . PublishStart = publishStart ;
You can’t perform that action at this time.
0 commit comments