My model is something like this:
public class Line
{
public int CatalogNumber {get; set;}
public int TeamCode {get; set;}
}
I have a view that gets catalog number and a team code, And I want to check two things:
- there is such catalog number in our database
- There is such catalog number for the given team
I wrote an attribute (that derives from ValidationAttribute
) that checks if there is such a catalog number in our Data Base. But it does nothing!
Maybe it's impossible to such check with an attribute?
(I know that I can implement IValidable
and override IsValid
method but for my own reasons I prefer doing it with an attribue).
I've to do it without serverPost (ajax would be good)
I'll really appreciate a good example hot to do it.
p.s. (We are using mvc3)