I have a table in bd sql sever called article with fields
IdArticulo, CodArticulo, DesArticulo, IsActivo
... in my mvc project valid almost all fields with data.annotation
... for example IdArticulo
with, CodArticulo
with ... but I do not know how to validate the field CodArticulo
that is unique in the BD ... For example, I entered an item in this way:
IdArticulo CodArticulo DesArticulo IsActivo
1 A001 GALLETA SODA 1
Up there all right ... but if I want to enter another item with the same code (A001) ... how could data.annotation
verify that a duplicate record is being entered?
Remember that the CodArticle field is unique and when validating it should return a
ErrorMessage:="An item with the same code already exists"
I hope your help.
Thank you.