I have two tables, Campaign and Advert with a one to many relationship. During Advert creation, the user selects a pre-defined Campaign to which the Advert will belong. A Campaign has an RRP money field and the Advert has a SalePrice money field. What I'm after is a way to ensure that the submitted Advert.SalePrice is >= the chosen Campaigns RRP.
Can this be done in the model? Something along the lines of this in the Advert_Validation? Is it even possible to fill the values of a Range with method calls?
[Range(0, getCampaignRRP(), ErrorMessage = "Value must be equal or greater than the Campaign RRP")]
public double SalePrice { get; set; }
Or do I need to check at the Controller level? All help appreciated!
Thanks all,
Jay