partial void OnValidate(ChangeAction action) {
if (!IsValid)
throw new ApplicationException("Rule violations prevent saving");
}
i am following this tutorial:
http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf
and am not able to compile the above code. it is in my NerdDinner.Models.Dinner
am i placing it in the wrong location?
here's the class:
public partial class Dinner {
public bool IsValid {
get { return (GetRuleViolations().Count() == 0); }
}
public IEnumerable<RuleViolation> GetRuleViolations() {
yield break;
}
partial void OnValidate(ChangeAction action) {
if (!IsValid)
throw new ApplicationException("Rule violations prevent saving");
}
}
here's the error im getting
Error 1 The type or namespace name 'ChangeAction' could not be found (are you missing a using directive or an assembly reference?)
please excuse the beginner's question and please let me know if you need any other details. im almost certain that im missing something fundamental here. can anyone please help with this? just run me through the necessary steps?