Skip to content

Commit

Permalink
fixed bug cannot create SpaceBar and Carousel widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
thiennn committed Feb 22, 2018
1 parent dd5c1bd commit 83dbf4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public async Task<IActionResult> 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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 83dbf4c

Please sign in to comment.