Exemplo n.º 1
0
        /// <summary>
        /// Переводит подьзователя из серверной модели в клиентскую
        /// </summary>
        /// <param name="modelUser">Пользователь в серверной модели</param>
        /// <returns>Пользователь в клиентской модели</returns>
        public static Client.User Convert(Model.User modelUser)
        {
            if (modelUser == null)
            {
                throw new ArgumentNullException(nameof(modelUser));
            }

            var clientUser = new Client.User
            {
                Id           = modelUser.Id.ToString(),
                Login        = modelUser.Login,
                RegisteredAt = modelUser.RegisteredAt
            };

            return(clientUser);
        }
        public static Client.User Convert(Model.User modelUser)
        {
            if (modelUser == null)
            {
                throw new ArgumentNullException(nameof(modelUser));
            }

            var clientUser = new Client.User
            {
                Id           = modelUser.Id,
                UserName     = modelUser.NormalizedUserName,
                Name         = modelUser.Name,
                Email        = modelUser.Email,
                PhoneNumber  = modelUser.PhoneNumber,
                Roles        = modelUser.Roles,
                RegisteredAt = modelUser.RegisteredAt,
                LastUpdateAt = modelUser.LastUpdateAt
            };

            return(clientUser);
        }
Exemplo n.º 3
0
        public static Client.User Convert(Model.User modelUser)
        {
            if (modelUser == null)
            {
                throw new ArgumentNullException(nameof(modelUser));
            }

            var clientUser = new Client.User
            {
                Id              = modelUser.Id,
                UserName        = modelUser.NormalizedUserName,
                Email           = modelUser.Email,
                PhoneNumber     = modelUser.PhoneNumber,
                Roles           = modelUser.Roles,
                CreatedTroubles = (IReadOnlyList <string>)modelUser.CreatedTroubles,
                LikedTroubles   = (IReadOnlyList <string>)modelUser.LikedTroubles,
                CreatedAt       = modelUser.CreatedAt,
                LastUpdatedAt   = modelUser.LastUpdatedAt
            };

            return(clientUser);
        }