-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Added] create user model (main perpose to validation)
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Linq; | ||
using System.Web; | ||
using ERPSystemTimologio.EF; | ||
|
||
namespace ERPSystemTimologio.Models | ||
{ | ||
public class UserCreateAdminModel : User | ||
{ | ||
[Required] | ||
[RegularExpression(@"^[10]+$", ErrorMessage = "The field must 0 or 1")] | ||
public new int Verified { get; set; } | ||
[Required] | ||
[MinLength(3)] | ||
public new string Name { get; set; } | ||
|
||
[Required] | ||
[MinLength(3)] | ||
[UniqueUsernameValidation] | ||
public new string Username { get; set; } | ||
|
||
[Required] | ||
[EmailAddress] | ||
[UniqueEmailValidation] | ||
public new string Email { get; set; } | ||
|
||
[Required] | ||
[Range(0, 500000)] | ||
public new double? Salary { get; set; } | ||
|
||
[Required] | ||
[MinLength(8)] | ||
[RegularExpression(@"^(?=.*[!@#$%^&*)(])(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$", ErrorMessage = "Password must contain at least one special character, one uppercase letter, one lowercase letter and one digit.")] | ||
public new string Password { get; set; } | ||
|
||
[Compare("Password")] | ||
public string CPassword { get; set; } | ||
|
||
[Required] | ||
[DataType(DataType.Date)] | ||
[DisplayFormat(DataFormatString = "yyyy-MM-dd")] | ||
public new DateTime? HireDate { get; set; } | ||
|
||
[Required] | ||
[Range(1, 4)] | ||
public new int Type { get; set; } | ||
|
||
[Range(0, int.MaxValue)] | ||
public new int? RegionId { get; set; } | ||
|
||
[Range(0, int.MaxValue)] | ||
public new int? BranchId { get; set; } | ||
|
||
public string LocalAddress { get; set; } | ||
|
||
public string PoliceStation { get; set; } | ||
|
||
public string City { get; set; } | ||
|
||
public string Country { get; set; } | ||
|
||
public string ZipCode { get; set; } | ||
|
||
public List<int> PermissionIds { get; set; } | ||
} | ||
} |