private Subscribe CreateModel() { var dataSourceId = RenderingContext.CurrentOrNull.Rendering.DataSource; var item = Sitecore.Context.Database.GetItem(dataSourceId); var mailingList = new Subscribe() { Title = new HtmlString(FieldRenderer.Render(item, "Title")), LabelInputArial = item.Fields["LabelInputArial"].Value, LabelInputPlaceHolder = item.Fields["LabelInputPlaceHolder"].Value, LabelButtonSubscribe = item.Fields["LabelButtonSubscribe"].Value, SubmitUrl = LinkUtil.GetUrlFromLinkField(item.Fields["SubmitUrl"]) }; return(mailingList); }
private HeroContent CreateModel() { var dataSourceId = RenderingContext.CurrentOrNull.Rendering.DataSource; var item = Sitecore.Context.Database.GetItem(dataSourceId); var heroContent = new HeroContent() { Title = new HtmlString(FieldRenderer.Render(item, "Title")), SubTitle = new HtmlString(FieldRenderer.Render(item, "SubTitle")), Description = new HtmlString(FieldRenderer.Render(item, "Description")), LinkMoreInformation = new HtmlString(FieldRenderer.Render(item, "LinkMoreInformation")), LinkJoin = new HtmlString(FieldRenderer.Render(item, "LinkJoin")), BackgroundImage = LinkUtil.GetUrlFromLinkField(item.Fields["BackgroundImage"]), VideoUrl = LinkUtil.GetUrlFromLinkField(item.Fields["VideoUrl"]), MainEventDate = ((DateField)item.Fields["MainEventDate"]).DateTime.ToString(), LabelDaysLeft = new HtmlString(FieldRenderer.Render(item, "LabelDaysLeft")), }; return(heroContent); }