示例#1
0
        public UserProfile()
        {
            CreateMap <User, UserModel>()
            .ForMember(x => x.DOB, x => x.MapFrom(u => GlobalSettings.ConvertDateToString(u.DOB)))
            .ForMember(x => x.CityName, x => x.MapFrom(u => u.City.Name))
            //.ForMember(x => x.Points, u => u.ResolveUsing<PointsResolver>());
            .ForMember(x => x.Points, u => u.MapFrom(c => c.UserSeasonLeagues.Where(z => z.IsActive).Any() ? c.UserSeasonLeagues.Where(z => z.IsActive).OrderByDescending(r => r.Id).First().Points : (int?)null));
            //.ForMember(x => x.ActiveLeague, u => u.ResolveUsing<ActiveLeagueResolver>());

            CreateMap <User, QueryableUserModel>()
            .ForMember(x => x.Points, u => u.MapFrom(c => c.UserSeasonLeagues.Where(z => z.IsActive).Any() ? c.UserSeasonLeagues.Where(z => z.IsActive).OrderByDescending(r => r.Id).First().Points : (int?)null));

            CreateMap <UserWithToken, UserWithTokenModel>()
            .ForMember(x => x.ExpiresAt, x => x.MapFrom(u => GlobalSettings.ConvertDateTimeToString(u.ExpiresAt)));
        }
示例#2
0
 public SeasonProfile()
 {
     CreateMap <Season, SeasonModel>()
     .ForMember(x => x.StartDate, x => x.MapFrom(u => GlobalSettings.ConvertDateTimeToString(u.StartDate)))
     .ForMember(x => x.EndDate, x => x.MapFrom(u => GlobalSettings.ConvertDateTimeToString(u.EndDate)));
 }
 public UserSeasonLeagueProfile()
 {
     CreateMap <UserSeasonLeague, UserActiveLeague>()
     .ForMember(x => x.SubscriptionDateTime, x => x.MapFrom(u => GlobalSettings.ConvertDateTimeToString(u.SubscriptionDateTime)));
 }