예제 #1
0
        public static UsersWithSomeRoleOutputModel ToOutputModel(User user)
        {
            var result = new UsersWithSomeRoleOutputModel
            {
                Id               = (int)user.Id,
                FirstName        = user.FirstName,
                Patronymic       = user.Patronymic,
                BirthDate        = user.BirthDate.ToString(),
                Email            = user.Email,
                Phone            = user.Phone,
                Bio              = user.Bio,
                City             = CityMapper.ToOutputModel(user.City).Name,
                RegistrationDate = user.RegistrationDate.ToString(),
                Roles            = RoleMapper.ToOutputModels(user.Roles)
            };

            return(result);
        }
예제 #2
0
        public static StudentWithCityOutputModel ToOutputModel(User user)
        {
            var tmp = new StudentWithCityOutputModel
            {
                Id               = (int)user.Id,
                FirstName        = user.FirstName,
                LastName         = user.LastName,
                Patronymic       = user.Patronymic,
                Email            = user.Email,
                Phone            = user.Phone,
                Bio              = user.Bio,
                BirthDate        = user.BirthDate,
                RegistrationDate = (DateTime)user.RegistrationDate,
                City             = CityMapper.ToOutputModel(user.City),
                Rating           = (int?)user.StudentGroup.Rating,
                Photo            = user.Photo,
            };

            return(tmp);
        }