This is a tightly coupled approach as your view models are coupled to your domain models. I personally do not prefer this way. I would go for another mapping method which maps from my domain model to viewmodel
If you really want the constructor approach, You may pass the Section
object to the constructor and set the property values.
public class SectionViewModel
{
public SectionViewModel(){}
public SectionViewModel(Section section)
{
//set the property values now.
Title=section.Title;
HasLogo=(section.Logo!=null && (section.Logo.ID>0));
}
public Int16 SectionID { get; set; }
public bool HasLogo { get; set; }
public string Type { get; set; }
public string Title { get; set; }
public string Synopsis { get; set; }
}
and when you want to create your view model object,
Section section=repositary.GetSection(someId);
SecionViewModel vm=new SectionViewModel(section);