Ejemplo n.º 1
0
        public static UserEntity ToDbEntity(this UserProfile_Dto data)
        {
            if (data == null)
            {
                return(null);
            }
            UserEntity result = new UserEntity()
            {
                Age                  = data.Age,
                DisplayImageUrl      = data.DisplayImageUrl,
                Email                = data.Email,
                FavoriteMusicId      = data.FavoriteMusicId,
                FavoriteSportId      = data.FavoriteSportId,
                FirstName            = data.FirstName,
                IsLocationVisible    = data.IsLocationVisible,
                IsMale               = data.IsMale,
                IsOtherGender        = data.IsOtherGender,
                LastName             = data.LastName,
                PhoneNumberConfirmed = data.PhoneNumberConfirmed,
                UserId               = data.Id,
                Username             = data.Username
            };

            return(result);
        }
Ejemplo n.º 2
0
        private static UserModel GetModelFromUserProfile(UserProfile_Dto data)
        {
            UserModel result = new UserModel();

            result.Age                  = data.Age;
            result.Email                = data.Email;
            result.FavoriteSportId      = data.FavoriteSportId;
            result.FavoriteMusicId      = data.FavoriteMusicId;
            result.FirstName            = data.FirstName;
            result.LastName             = data.LastName;
            result.PhoneNumberConfirmed = data.PhoneNumberConfirmed;
            result.ShareLocation        = data.IsLocationVisible;
            result.Id       = data.Id;
            result.Username = data.Username;

            var staticDataProxy = Mvx.Resolve <IStaticDataProxy>();

            if (result.FavoriteSportId.HasValue)
            {
                var favoriteSport = staticDataProxy.GetFavoriteSportByIdAsync(result.FavoriteSportId.Value).Result;
                if (favoriteSport != null)
                {
                    result.FavoriteSportName = favoriteSport.Data.Name;
                }
            }
            if (result.FavoriteMusicId.HasValue)
            {
                var favoriteMusic = staticDataProxy.GetFavoriteMusicByIdAsync(result.FavoriteMusicId.Value).Result;
                if (favoriteMusic != null)
                {
                    result.FavoriteMusicName = favoriteMusic.Data.Name;
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static UserProfile_Dto ToProfileDto(this UserModel data)
        {
            UserProfile_Dto result = new UserProfile_Dto()
            {
            };

            return(result);
        }
Ejemplo n.º 4
0
        public static UserEntity UpdateDbEntity(this UserProfile_Dto data, UserEntity result)
        {
            if (result == null)
            {
                return(result);
            }
            result.Age                  = data.Age;
            result.DisplayImageUrl      = data.DisplayImageUrl;
            result.Email                = data.Email;
            result.FavoriteMusicId      = data.FavoriteMusicId;
            result.FavoriteSportId      = data.FavoriteSportId;
            result.FirstName            = data.FirstName;
            result.IsLocationVisible    = data.IsLocationVisible;
            result.IsMale               = data.IsMale;
            result.IsOtherGender        = data.IsOtherGender;
            result.LastName             = data.LastName;
            result.PhoneNumberConfirmed = data.PhoneNumberConfirmed;
            result.UserId               = data.Id;
            result.Username             = data.Username;

            return(result);
        }
Ejemplo n.º 5
0
 public static UserModel ToModel(this UserProfile_Dto data)
 {
     return(GetModelFromUserProfile(data));
 }