public void FromDto(ProductTypeDTO dto) { if (dto == null) return; this.Bvin = dto.Bvin ?? string.Empty; this.StoreId = dto.StoreId; this.IsPermanent = dto.IsPermanent; this.LastUpdated = dto.LastUpdated; this.ProductTypeName = dto.ProductTypeName ?? string.Empty; }
// DTO public ProductTypeDTO ToDto() { ProductTypeDTO dto = new ProductTypeDTO(); dto.Bvin = this.Bvin; dto.StoreId = this.StoreId; dto.IsPermanent = this.IsPermanent; dto.LastUpdated = this.LastUpdated; dto.ProductTypeName = this.ProductTypeName; return dto; }
// Properties and Types private void ImportProductTypes() { Header("Importing Product Types"); data.bvc2004Entities oldDatabase = GetOldDatabase(); foreach (data.bvc_ProductType old in oldDatabase.bvc_ProductType) { wl("Item: " + old.ProductTypeName); ProductTypeDTO pt = new ProductTypeDTO(); pt.Bvin = old.ID.ToString(); pt.IsPermanent = false; pt.LastUpdated = DateTime.UtcNow; pt.ProductTypeName = old.ProductTypeName; Api bv6proxy = GetBV6Proxy(); var res = bv6proxy.ProductTypesCreate(pt); if (res != null) { if (res.Errors.Count() > 0) { DumpErrors(res.Errors); wl("FAILED"); } else { MigratePropertiesForType(old.ID); wl("SUCCESS"); } } } }
public ApiResponse<ProductTypeDTO> ProductTypesUpdate(ProductTypeDTO item) { ApiResponse<ProductTypeDTO> result = new ApiResponse<ProductTypeDTO>(); result = RestHelper.PostRequest<ApiResponse<ProductTypeDTO>>(this.fullApiUri + "producttypes/" + Enc(item.Bvin) + "?key=" + Enc(key), MerchantTribe.Web.Json.ObjectToJson(item)); return result; }