Advertisement
Gyoshev

Untitled

Mar 3rd, 2017
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.ComponentModel.DataAnnotations;
  7. using System.ComponentModel.DataAnnotations.Schema;
  8.  
  9. namespace Users
  10. {
  11. class User
  12. {
  13. [Key]
  14. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  15. [Range(1, 2147483647)]
  16. public int Id { get; set; }
  17. [Required]
  18. [StringLength(30,MinimumLength = 4, ErrorMessage = "Username must be between 4 and 30 simbols")]
  19. public string Username { get; set; }
  20. [Required]
  21. [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{6,50}$)]", ErrorMessage = "Error password validation")]
  22. public string Password { get; set; }
  23. [Required]
  24. [RegularExpression(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$", ErrorMessage = "Error Email validation")]
  25. public string Email { get; set; }
  26. [StringLength(1048576)]
  27. public string ProfilePicture { get; set; }
  28. public DateTime RegisteredOn { get; set; }
  29. public DateTime LastTimeLoggedIn { get; set; }
  30. [Range(1, 120)]
  31. public byte Age { get; set; }
  32. public bool IsDeleted { get; set; }
  33. }
  34. }
  35.  
  36. //StartUp класа
  37. using System;
  38. using System.Collections.Generic;
  39. using System.Linq;
  40. using System.Text;
  41. using System.Threading.Tasks;
  42.  
  43. namespace Users
  44. {
  45. class StartUp
  46. {
  47. static void Main(string[] args)
  48. {
  49. User user = new User()
  50. {
  51. Username = "Stewart",
  52. Password = "YZK93CHX2QX",
  53. Email = "Nam@acnulla.co.uk",
  54. RegisteredOn = new DateTime(11 / 19 / 2001),
  55. LastTimeLoggedIn = new DateTime(02 / 12 / 2015),
  56. Age = 18,
  57. IsDeleted = false
  58. };
  59. Console.WriteLine("{0} {1} {2} {3} {4} {5} {6}",
  60. user.Username, user.Password, user.Email, user.RegisteredOn,
  61. user.LastTimeLoggedIn, user.Age, user.IsDeleted);
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement