Files
MileageTraker/Web/ViewModels/User/ExportUserViewModel.cs
T
2013-01-12 14:58:33 -05:00

38 lines
865 B
C#

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<Models.User, ExportUserViewModel>()
.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);
}
}
}