Пример #1
0
        /// <summary>
        /// Converts this instance of <see cref="JobItem"/> to an instance of <see cref="JobItemDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="JobItem"/> to convert.</param>
        public static JobItemDTO ToDTO(this JobItem entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new JobItemDTO();

            dto.Id           = entity.Id;
            dto.State        = entity.State;
            dto.FailedReason = entity.FailedReason;
            dto.ItemHostId   = entity.ItemHostId;

            return(dto);
        }
Пример #2
0
        /// <summary>
        /// Converts this instance of <see cref="JobItemDTO"/> to an instance of <see cref="JobItem"/>.
        /// </summary>
        /// <param name="dto"><see cref="JobItemDTO"/> to convert.</param>
        public static JobItem ToEntity(this JobItemDTO dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new JobItem();

            entity.Id           = dto.Id;
            entity.State        = dto.State;
            entity.FailedReason = dto.FailedReason;
            entity.ItemHostId   = dto.ItemHostId;

            return(entity);
        }