Created
October 13, 2016 12:10
-
-
Save sshibani/b0f91f37d053c4ba072cdfaa6c392e5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductPriceFieldAttribute : FieldAttributeBase | |
{ | |
public override IEnumerable GetFieldValues(IField field, IModelProperty property, ITemplate template, IViewModelFactory factory) | |
{ | |
IEnumerable fieldValue = null; | |
var productId = field.Values.FirstOrDefault(); | |
var productService = new ProductService(); | |
var price = productService.GetProduct(productId).Price; | |
return new[] { price }; | |
} | |
public override Type ExpectedReturnType | |
{ | |
get | |
{ | |
return typeof(double); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment