using System.Web.Mvc; using System.Linq; using AutoMapper; namespace MileageTraker.Web.ViewModels.User { public class ExportUserViewModel { public string FullName { get; set; } public string Username { get; set; } public string Email { get; set; } public string Roles { get; set; } public bool IsLockedOut { get; set; } public bool IsApproved { get; set; } public string LastActivityDate { get; set; } public string LastLoginDate { get; set; } public string LastPasswordChangedDate { get; set; } static ExportUserViewModel() { Mapper.CreateMap() .ForMember(u => u.Roles, opt => opt.MapFrom(u => string.Join((", "), u.Roles.Select(r => r.RoleName)))); } public ExportUserViewModel(Models.User user) { Mapper.Map(user, this); } } }