示例#1
0
 public static User ToEfModel(this Dal.User user)
 {
     return(new User()
     {
         Id = user.Id,
         Email = user.Name,
         Password = user.Password
     });
 }
示例#2
0
 public static User ToBlModel(this Data.User user)
 {
     return(new User()
     {
         Id = user.Id,
         Name = user.Name,
         Email = user.Name,
         Password = user.Password
     });
 }
        private void MergeProfileIntoUser(Data.User user, Profile profile)
        {
            user.Bio         = !string.IsNullOrWhiteSpace(profile.Bio) ? profile.Bio : null;
            user.DateOfBirth = profile.DateOfBirth;
            user.FirstName   = !string.IsNullOrWhiteSpace(profile.FirstName) ? profile.FirstName : null;
            user.LastName    = !string.IsNullOrWhiteSpace(profile.LastName) ? profile.LastName : null;

            if (profile.Country != null)
            {
                user.Country   = mapper.Map <Country, Data.Navigationless.Country>(profile.Country);
                user.CountryId = profile.Country.Id;
            }
            else if (profile.CountryId != null)
            {
                user.CountryId = profile.CountryId;
                user.Country   = mapper.Map <Data.Country, Data.Navigationless.Country>(countryRepository.Find(profile.CountryId.Value));
            }
            else
            {
                user.CountryId = null;
                user.Country   = null;
            }
        }