public void FromDto(ProductRelationshipDTO dto) { if (dto == null) return; this.Id = dto.Id; this.StoreId = dto.StoreId; this.ProductId = dto.ProductId; this.RelatedProductId = dto.RelatedProductId; this.IsSubstitute = dto.IsSubstitute; this.SortOrder = dto.SortOrder; this.MarketingDescription = dto.MarketingDescription; }
//DTO public ProductRelationshipDTO ToDto() { ProductRelationshipDTO dto = new ProductRelationshipDTO(); dto.Id = this.Id; dto.StoreId = this.StoreId; dto.ProductId = this.ProductId; dto.RelatedProductId = this.RelatedProductId; dto.IsSubstitute = this.IsSubstitute; dto.SortOrder = this.SortOrder; dto.MarketingDescription = this.MarketingDescription; return dto; }
public ApiResponse<ProductRelationshipDTO> ProductRelationshipsUpdate(ProductRelationshipDTO item) { ApiResponse<ProductRelationshipDTO> result = new ApiResponse<ProductRelationshipDTO>(); result = RestHelper.PostRequest<ApiResponse<ProductRelationshipDTO>>(this.fullApiUri + "productrelationships/" + item.Id + "?key=" + Enc(key), MerchantTribe.Web.Json.ObjectToJson(item)); return result; }
public ApiResponse<bool> ProductRelationshipsQuickCreate(string productBvin, string otherProductBvin, bool isSubstitute) { ApiResponse<bool> response = new ApiResponse<bool>(); ProductRelationshipDTO r = new ProductRelationshipDTO(); r.IsSubstitute = isSubstitute; r.ProductId = productBvin; r.RelatedProductId = otherProductBvin; ApiResponse<ProductRelationshipDTO> result = ProductRelationshipsCreate(r); if (result.Content != null) { if (result.Content.Id > 0) { response.Content = true; } } response.Errors = result.Errors; return response; }