I made this function to fetch all the members with their custom properties. I was just wondering whether this is written performant or not. Are there any - performance wise - cleaner solutions? Or is it okay to work with?
public List<DashboardMemberModel> GetAllMembers()
{
//Members
var members = ApplicationContext.Services.MemberService.GetAllMembers();
//Populate List<DashboardMemberModel> & Return
return members.Select(member => new DashboardMemberModel
{
Id = member.Id,
FirstName = Umbraco.TypedMember(member.Id).GetPropertyValue("firstName").ToString(),
LastName = Umbraco.TypedMember(member.Id).GetPropertyValue("lastName").ToString(),
Company = Umbraco.TypedMember(member.Id).GetPropertyValue("companyName").ToString()
}).OrderBy(member => member.Id).ToList();
}
Kind regards