예제 #1
0
 public static UserLoginPassOutputModel ToOutputModel(User currentUser)
 {
     return(new UserLoginPassOutputModel
     {
         Id = (int)currentUser.Id,
         Login = currentUser.Login,
         Roles = RoleMapper.ToOutputModels(currentUser.Roles)
     });
 }
예제 #2
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);
        }