Пример #1
0
 public PlatformItemDTO(Int64 id, Int64 itemId, Int64 detectedCount, Int64 detectedInModuleCount, DateTime lastDetectionTime, String logHistory, RouteDTO route, PlatformItemDTO itemBehind, PlatformItemDTO itemInFront, PlatformModuleEntityDTO associatedPlatformModuleEntity)
 {
     Id                             = id;
     ItemId                         = itemId;
     DetectedCount                  = detectedCount;
     DetectedInModuleCount          = detectedInModuleCount;
     LastDetectionTime              = lastDetectionTime;
     LogHistory                     = logHistory;
     Route                          = route;
     ItemBehind                     = itemBehind;
     ItemInFront                    = itemInFront;
     AssociatedPlatformModuleEntity = associatedPlatformModuleEntity;
 }
        /// <summary>
        /// Converts this instance of <see cref="PlatformModuleEntity"/> to an instance of <see cref="PlatformModuleEntityDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="PlatformModuleEntity"/> to convert.</param>
        public static PlatformModuleEntityDTO ToDTO(this PlatformModuleEntity entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new PlatformModuleEntityDTO();

            dto.Id             = entity.Id;
            dto.Name           = entity.Name;
            dto.LimitItemCount = entity.LimitItemCount;

            return(dto);
        }
        /// <summary>
        /// Converts this instance of <see cref="PlatformModuleEntityDTO"/> to an instance of <see cref="PlatformModuleEntity"/>.
        /// </summary>
        /// <param name="dto"><see cref="PlatformModuleEntityDTO"/> to convert.</param>
        public static PlatformModuleEntity ToEntity(this PlatformModuleEntityDTO dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new PlatformModuleEntity();

            entity.Id             = dto.Id;
            entity.Name           = dto.Name;
            entity.LimitItemCount = dto.LimitItemCount;

            return(entity);
        }