|  | 
| 1 |  | -using System; | 
| 2 |  | -using System.Collections.Generic; | 
| 3 |  | -using System.Text; | 
| 4 |  | -using System.ComponentModel.DataAnnotations; | 
| 5 |  | -using System.Runtime.CompilerServices; | 
| 6 |  | - | 
| 7 |  | -namespace Blazor_EditForm.Data | 
| 8 |  | -{ | 
| 9 |  | -    /// <summary> | 
| 10 |  | -    /// Get the employee details  | 
| 11 |  | -    /// </summary> | 
| 12 |  | -    public class EmployeeDetails | 
| 13 |  | -    { | 
| 14 |  | -        [Required] | 
| 15 |  | -        public string FirstName { get; set; } | 
| 16 |  | -        public string LastName { get; set; } | 
| 17 |  | -        [Required] | 
| 18 |  | -        [DataType(DataType.EmailAddress)] | 
| 19 |  | -        [EmailAddress] | 
| 20 |  | -        public string Email { get; set; } | 
| 21 |  | -        public string Gender { get; set; } = "male"; | 
| 22 |  | -        [Required] | 
| 23 |  | -        [DataType(DataType.PhoneNumber)] | 
| 24 |  | -        [Phone] | 
| 25 |  | -        public string PhoneNumber { get; set; } | 
| 26 |  | -        [Required] | 
| 27 |  | -        public DateTime? DOB { get; set; } | 
| 28 |  | -        [Required] | 
| 29 |  | -        public string Country { get; set; } | 
| 30 |  | -        [Required] | 
| 31 |  | -        public string City { get; set; } | 
| 32 |  | -        [Required] | 
| 33 |  | -        public string Address { get; set; } | 
| 34 |  | -        [Required] | 
| 35 |  | -        [Range(0, 20, ErrorMessage = "The Experience range should be 0 to 20")] | 
| 36 |  | -        public decimal? TotalExperience { get; set; } | 
| 37 |  | -    } | 
| 38 |  | - | 
| 39 |  | -    public class Countries | 
| 40 |  | -    { | 
| 41 |  | -        public string Name { get; set; } | 
| 42 |  | -        public string Code { get; set; } | 
| 43 |  | - | 
| 44 |  | -        public List<Countries> GetCountries() | 
| 45 |  | -        { | 
| 46 |  | -            List<Countries> Country = new List<Countries> | 
| 47 |  | -            { | 
| 48 |  | -                new Countries() { Name = "Australia", Code = "AU" }, | 
| 49 |  | -                new Countries() { Name = "United Kingdom", Code = "UK" }, | 
| 50 |  | -                new Countries() { Name = "United States", Code = "US" }, | 
| 51 |  | -            }; | 
| 52 |  | -            return Country; | 
| 53 |  | -        } | 
| 54 |  | -    } | 
| 55 |  | -    public class Cities | 
| 56 |  | -    { | 
| 57 |  | -        public string Name { get; set; } | 
| 58 |  | -        public string Code { get; set; } | 
| 59 |  | -        public string CountryCode { get; set; } | 
| 60 |  | -        public List<Cities> GetCities() | 
| 61 |  | -        { | 
| 62 |  | -            List<Cities> CityName = new List<Cities> | 
| 63 |  | -            { | 
| 64 |  | -                new Cities() { Name = "New York", CountryCode = "US", Code="US-101" }, | 
| 65 |  | -                new Cities() { Name = "Virginia", CountryCode = "US", Code="US-102" }, | 
| 66 |  | -                new Cities() { Name = "Washington", CountryCode = "US", Code="US-103" }, | 
| 67 |  | -                new Cities() { Name = "Victoria", CountryCode = "AU", Code="AU-101" }, | 
| 68 |  | -                new Cities() { Name = "Tasmania", CountryCode = "AU", Code="AU-102" }, | 
| 69 |  | -                new Cities() { Name = "Queensland", CountryCode = "AU", Code="AU-103" }, | 
| 70 |  | -                new Cities() { Name = "London", CountryCode = "UK", Code="UK-101" }, | 
| 71 |  | -                new Cities() { Name = "Manchester", CountryCode = "UK", Code="UK-102" }, | 
| 72 |  | -                new Cities() { Name = "Ashford", CountryCode = "UK", Code="UK-103" } | 
| 73 |  | -            }; | 
| 74 |  | -            return CityName; | 
| 75 |  | -        } | 
| 76 |  | -    } | 
| 77 |  | -} | 
|  | 1 | +using System; | 
|  | 2 | +using System.Collections.Generic; | 
|  | 3 | +using System.Text; | 
|  | 4 | +using System.ComponentModel.DataAnnotations; | 
|  | 5 | +using System.Runtime.CompilerServices; | 
|  | 6 | + | 
|  | 7 | +namespace EditFormValidation.Data | 
|  | 8 | +{ | 
|  | 9 | +    /// <summary> | 
|  | 10 | +    /// Get the employee details  | 
|  | 11 | +    /// </summary> | 
|  | 12 | +    public class EmployeeDetails | 
|  | 13 | +    { | 
|  | 14 | +        [Required] | 
|  | 15 | +        public string FirstName { get; set; } | 
|  | 16 | +        public string LastName { get; set; } | 
|  | 17 | +        [Required] | 
|  | 18 | +        [DataType(DataType.EmailAddress)] | 
|  | 19 | +        [EmailAddress] | 
|  | 20 | +        public string Email { get; set; } | 
|  | 21 | +        public string Gender { get; set; } = "male"; | 
|  | 22 | +        [Required] | 
|  | 23 | +        [DataType(DataType.PhoneNumber)] | 
|  | 24 | +        [Phone] | 
|  | 25 | +        public string PhoneNumber { get; set; } | 
|  | 26 | +        [Required] | 
|  | 27 | +        public DateTime? DOB { get; set; } | 
|  | 28 | +        [Required] | 
|  | 29 | +        public string Country { get; set; } | 
|  | 30 | +        [Required] | 
|  | 31 | +        public string City { get; set; } | 
|  | 32 | +        [Required] | 
|  | 33 | +        public string Address { get; set; } | 
|  | 34 | +        [Required] | 
|  | 35 | +        [Range(0, 20, ErrorMessage = "The Experience range should be 0 to 20")] | 
|  | 36 | +        public decimal? TotalExperience { get; set; } | 
|  | 37 | +    } | 
|  | 38 | + | 
|  | 39 | +    public class Countries | 
|  | 40 | +    { | 
|  | 41 | +        public string Name { get; set; } | 
|  | 42 | +        public string Code { get; set; } | 
|  | 43 | + | 
|  | 44 | +        public List<Countries> GetCountries() | 
|  | 45 | +        { | 
|  | 46 | +            List<Countries> Country = new List<Countries> | 
|  | 47 | +            { | 
|  | 48 | +                new Countries() { Name = "Australia", Code = "AU" }, | 
|  | 49 | +                new Countries() { Name = "United Kingdom", Code = "UK" }, | 
|  | 50 | +                new Countries() { Name = "United States", Code = "US" }, | 
|  | 51 | +            }; | 
|  | 52 | +            return Country; | 
|  | 53 | +        } | 
|  | 54 | +    } | 
|  | 55 | +    public class Cities | 
|  | 56 | +    { | 
|  | 57 | +        public string Name { get; set; } | 
|  | 58 | +        public string Code { get; set; } | 
|  | 59 | +        public string CountryCode { get; set; } | 
|  | 60 | +        public List<Cities> GetCities() | 
|  | 61 | +        { | 
|  | 62 | +            List<Cities> CityName = new List<Cities> | 
|  | 63 | +            { | 
|  | 64 | +                new Cities() { Name = "New York", CountryCode = "US", Code="US-101" }, | 
|  | 65 | +                new Cities() { Name = "Virginia", CountryCode = "US", Code="US-102" }, | 
|  | 66 | +                new Cities() { Name = "Washington", CountryCode = "US", Code="US-103" }, | 
|  | 67 | +                new Cities() { Name = "Victoria", CountryCode = "AU", Code="AU-101" }, | 
|  | 68 | +                new Cities() { Name = "Tasmania", CountryCode = "AU", Code="AU-102" }, | 
|  | 69 | +                new Cities() { Name = "Queensland", CountryCode = "AU", Code="AU-103" }, | 
|  | 70 | +                new Cities() { Name = "London", CountryCode = "UK", Code="UK-101" }, | 
|  | 71 | +                new Cities() { Name = "Manchester", CountryCode = "UK", Code="UK-102" }, | 
|  | 72 | +                new Cities() { Name = "Ashford", CountryCode = "UK", Code="UK-103" } | 
|  | 73 | +            }; | 
|  | 74 | +            return CityName; | 
|  | 75 | +        } | 
|  | 76 | +    } | 
|  | 77 | +} | 
0 commit comments