Esempio n. 1
0
        /// <summary>
        /// Converts this instance of <see cref="Client"/> to an instance of <see cref="ClientDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="Client"/> to convert.</param>
        public static ClientDTO ToDTO(this Client entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new ClientDTO();

            dto.ClientID     = entity.ClientID;
            dto.FirstName    = entity.FirstName;
            dto.LastName     = entity.LastName;
            dto.TypeOfClient = entity.TypeOfClient;

            entity.OnDTO(dto);

            return(dto);
        }
Esempio n. 2
0
        /// <summary>
        /// Converts this instance of <see cref="ClientDTO"/> to an instance of <see cref="Client"/>.
        /// </summary>
        /// <param name="dto"><see cref="ClientDTO"/> to convert.</param>
        public static Client ToEntity(this ClientDTO dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new Client();

            entity.ClientID     = dto.ClientID;
            entity.FirstName    = dto.FirstName;
            entity.LastName     = dto.LastName;
            entity.TypeOfClient = dto.TypeOfClient;

            dto.OnEntity(entity);

            return(entity);
        }
Esempio n. 3
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="Client"/> converted from <see cref="ClientDTO"/>.</param>
 static partial void OnEntity(this ClientDTO dto, Client entity);
Esempio n. 4
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="ClientDTO"/> converted from <see cref="Client"/>.</param>
 static partial void OnDTO(this Client entity, ClientDTO dto);