public ProductDTO Update(string id, ProductDTO instance) { instance.ProductId = Int32.Parse(id); return Product.UpdateProduct(Int32.Parse(id), instance).ToDTO(); }
/// <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);
public ProductDTO Create(ProductDTO instance) { return Product.AddProduct(instance.ToEntity()).ToDTO(); }
/// <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; }