In my MVC application I have a requirement where I want user to insert Unique value in a column.
i.e.: Username
should be unique in Users
table.
I used [Indes(IsUnique = true)]
data annotation in my model.
But when I insert duplicate value in the field it throws an exception, but I want to display an Error Message on my View saying Please try with a different Username
Please help me what should I do here?