示例#1
0
        public UserPhoneDTO Update(UserPhoneDTO oUserPhoneDTO)
        {
            UserPhoneDTO returnUserPhone = null;
            if (oUserPhoneDTO != null && oUserPhoneDTO.UserPhoneID > 0)
            {
                oUserPhoneRepo.UpdateUserPhone(0, UserPhoneAssembler.ToEntity(oUserPhoneDTO));
                returnUserPhone = oUserPhoneDTO;
            }

            return returnUserPhone;
        }
        /// <summary>
        /// Converts this instance of <see cref="UserPhone"/> to an instance of <see cref="UserPhoneDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="UserPhone"/> to convert.</param>
        public static UserPhoneDTO ToDTO(this UserPhone entity)
        {
            if (entity == null) return null;

            var dto = new UserPhoneDTO();

            dto.UserPhoneID = entity.UserPhoneID;
            dto.UserID = entity.UserID;
            dto.PhoneID = entity.PhoneID;
            dto.IsPrimary = entity.IsPrimary;

            entity.OnDTO(dto);

            return dto;
        }
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="UserPhoneDTO"/> converted from <see cref="UserPhone"/>.</param>
 static partial void OnDTO(this UserPhone entity, UserPhoneDTO dto);
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="UserPhoneDTO"/> converted from <see cref="UserPhone"/>.</param>
 static partial void OnDTO(this UserPhone entity, UserPhoneDTO dto) {
     if (entity != null && entity.Phone != null)
         dto.Phone = PhoneAssembler.ToDTO(entity.Phone);
 }