public static function PopulateAttributeListViewModelList($attributes) { for ($i = 0; $i < count($attributes); $i++) { $models[$i] = AttributeValueFloatHelper::PopulateAttributeValueFloatViewModel($attributes[$i]); } return $models; }
public static function PopulateProductEditViewModel($product) { $model = new ProductEditViewModel(); $model->id = $product->id; $model->name = $product->name; $model->description = $product->description; $model->price = $product->price; $model->AttributesFloat = AttributeValueFloatHelper::PopulateAttributeValueFloatViewModelList(AttributeValueFloatService::GetByProductId($product->product_id)); $model->AttributesList = AttributeValueListHelper::PopulateAttributeValueListViewModelList(AttributeValueListService::GetByProductId($product->product_id)); for ($i = 0; $i < count($model->AttributesList); $i++) { $model->AttributesListValue[$i] = AttributeListService::GetValuesByAttributeId($model->AttributesList[$i]->attribute->id); } return $model; }