Scenario
Your company wants you to add a new validation rule for designation so that it consists of at least two words. (Hint: use regex.)
Aim
Add a new validation rule for the designation property.
Steps for completion
Revise the designation property in EmployeeAddViewModel.cs, as follows:
Go to https://goo.gl/bK5Ece to access the code.
[Required(ErrorMessage = "Employee Designation is required")]
[MinLength(5, ErrorMessage = "Minimum length of designation should be 5 characters")]
[RegularExpression(@"^[a-z]+(?:\s[a-z]+)+$", ErrorMessage = "Designation should be at least two
words")]
public string Designation { get; set; }