internal static ImageCarouselTemplate Convert(IImageCarouselTemplate template) { if (!(template is ImageCarouselTemplate imageCarouselTemplate)) { imageCarouselTemplate = new ImageCarouselTemplate(); } if (template.Columns == null) { throw new InvalidOperationException("The columns cannot be null."); } imageCarouselTemplate.Columns = ImageCarouselColumn.Convert(template.Columns); return(imageCarouselTemplate); }
private static ImageCarouselColumn Convert(IImageCarouselColumn column) { if (column.ImageUrl == null) { throw new InvalidOperationException("The image url cannot be null."); } if (!(column is ImageCarouselColumn imageCarouselColumn)) { imageCarouselColumn = new ImageCarouselColumn() { ImageUrl = column.ImageUrl, }; } if (column.Action == null) { throw new InvalidOperationException("The action cannot be null."); } imageCarouselColumn.Action = TemplateAction.Convert(column.Action); return(imageCarouselColumn); }