Files
MileageTraker/Web/ViewModels/User/ExportUserViewModel.cs
T
poprhythm b19b44305a Add details to emails
A few clarifications
2013-01-15 15:28:17 -05:00

44 lines
1.0 KiB
C#

using System;
using System.Linq;
using AutoMapper;
using MileageTraker.Web.Utility;
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<DateTime, string>()
.ConvertUsing(dt =>
dt.IsSqlMinValue()
? string.Empty
: dt.Date.ToString("d"));
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);
}
}
}