예제 #1
0
 public ProductDTO Update(string id, ProductDTO instance)
 {
     instance.ProductId = Int32.Parse(id);
     return Product.UpdateProduct(Int32.Parse(id), instance).ToDTO();
 }
예제 #2
0
파일: Core.DTO.cs 프로젝트: wangn6/rep2
        /// <summary>
        /// Invoked when <see cref="ToDTO"/> operation is about to return.
        /// </summary>
        /// <param name="dto"><see cref="ProductDTO"/> converted from <see cref="Product"/>.</param>
partial         static void OnDTO(this Product entity, ProductDTO dto);
예제 #3
0
 public ProductDTO Create(ProductDTO instance)
 {
     return Product.AddProduct(instance.ToEntity()).ToDTO();
 }
예제 #4
0
파일: Core.DTO.cs 프로젝트: wangn6/rep2
        /// <summary>
        /// Converts this instance of <see cref="Product"/> to an instance of <see cref="ProductDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="Product"/> to convert.</param>
        public static ProductDTO ToDTO(this Product entity)
        {
            if (entity == null) return null;

            var dto = new ProductDTO();

            dto.ProductId = entity.ProductId;
            dto.Name = entity.Name;
            dto.Description = entity.Description;
            if (entity.BuildProviderId != null)
            {
                dto.BuildProviderId = entity.BuildProviderId.Value;
            }
            if (entity.EnvironmentProviderId != null)
            {
                dto.EnvironmentProviderId = entity.EnvironmentProviderId.Value;
            }
            if (entity.TestCaseProviderId != null)
            {
                dto.TestCaseProviderId = entity.TestCaseProviderId.Value;
            }
            dto.RunTime = entity.RunTime;
            if (entity.RQMProjectAlias != null)
            {
                dto.RQMProjectAlias = entity.RQMProjectAlias;
            }

            entity.OnDTO(dto);

            return dto;
        }