TeamMemberPart has many SkillPartRecord

Topics: Customizing Orchard, Writing modules
May 25, 2012 at 4:14 PM

Hi guys,

I have a trouble, I need to create a module that map my TeamMember and theirs Skills.

So I created a Part for the member and one for the skills. I show you:

[OrchardFeature("Orchard.Raise.Common.TeamMember")]
public class TeamMemberPart : ContentPart<TeamMemberPartRecord>
{
	public string ImgUrl
	{
		get { return Record.ImgUrl; }
		set { Record.ImgUrl = value; }
	}
	public string JobTitle
	{
		get { return Record.JobTitle; }
		set { Record.JobTitle = value; }
	}
	public string Name
	{
		get { return Record.Name; }
		set { Record.Name = value; }
	}
	public int Position
	{
		get { return Record.Position; }
		set { Record.Position = value; }
	}
	public string Surname
	{
		get { return Record.Surname; }
		set { Record.Surname = value; }
	}
	public IEnumerable<SkillPartRecord> Skills
	{
		get { return Record.Skills.Select(s => s.SkillPartRecord); }
	}
}

and Skills:

[OrchardFeature("Orchard.Raise.Common.Skill")]
public class SkillPartRecord : ContentPartRecord
{
	public virtual string Name { get; set; }
	public virtual int Knowledgment { get; set; }
}

When I need to create a new TeamMember I need to show the available skills and when I modify TeamMembers I'd like to print the avaiable skills and check which skills the current TeamMember has.

I used the tutorial: http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations

but in this one there isn't a ViewModel with others properties like mine.
So when I modify something my part it is null.

Any idea? 

May 29, 2012 at 11:02 AM

Anyone can say me why my 

  if (part.ContentItem.Id != 0) {
                _rewardService.UpdateRewardsForContentItem(
                    part.ContentItem, model.Rewards);
            }

is empty?

Tnx