Skip to content

Commit

Permalink
[Added] create user model (main perpose to validation)
Browse files Browse the repository at this point in the history
  • Loading branch information
nobir committed Jul 17, 2022
1 parent 04e417b commit 580f83a
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions Models/UserCreateAdminModel.cs
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; }
}
}

0 comments on commit 580f83a

Please sign in to comment.