I'm working in Umbraco 7 and I'm trying to map data to a custom entity i have created. Mapping strings, int ect. is quite simple but can someone tell me how i can map content created from Media picker, Multi Media picker and Content picker?
My simple model:
public class Frontpage : Master { public string Headline { get; set; } public HtmlString Content { get; set; } public string Image { get; set; }
public IEnumerable<XXXX> Images { get; set; } <-- What class/type should I place here (IMedia mayby) public IEnumerable<XXXX> Links { get; set; } <-- What class/type should I place here (IContent mayby) public IEnumerable<NewsItem> News { get; set; } }
In my repository I have this method:
public Frontpage GetFrontPage(IPublishedContent content) { var imageObject = How do I map a image from image picker here var imagesObject = How do I map images from multi media picker here var linksObject = How do I map a multiple links from content picker here
var model = new Frontpage { Headline = !string.IsNullOrEmpty(content.GetPropertyValue<string>("headline")) ? content.GetPropertyValue<string>("headline") : content.Name, Content = new HtmlString(content.GetPropertyValue<string>("content")), Image = And finally what goes here, Images = And finally what goes here, Links = And finally what goes here, News = null };
return model; }
I hope this makes sence to some of you guys/girls ;o)
Getting Media from code in repository
Hi there,
I'm working in Umbraco 7 and I'm trying to map data to a custom entity i have created. Mapping strings, int ect. is quite simple but can someone tell me how i can map content created from Media picker, Multi Media picker and Content picker?
My simple model:
public class Frontpage : Master
{
public string Headline { get; set; }
public HtmlString Content { get; set; }
public string Image { get; set; }
public IEnumerable<XXXX> Images { get; set; } <-- What class/type should I place here (IMedia mayby)
public IEnumerable<XXXX> Links { get; set; } <-- What class/type should I place here (IContent mayby)
public IEnumerable<NewsItem> News { get; set; }
}
In my repository I have this method:
public Frontpage GetFrontPage(IPublishedContent content)
{
var imageObject = How do I map a image from image picker here
var imagesObject = How do I map images from multi media picker here
var linksObject = How do I map a multiple links from content picker here
var model = new Frontpage {
Headline = !string.IsNullOrEmpty(content.GetPropertyValue<string>("headline")) ? content.GetPropertyValue<string>("headline") : content.Name,
Content = new HtmlString(content.GetPropertyValue<string>("content")),
Image = And finally what goes here,
Images = And finally what goes here,
Links = And finally what goes here,
News = null
};
return model;
}
I hope this makes sence to some of you guys/girls ;o)
is working on a reply...