AccountModels.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using System.Data.Entity;
  6. using System.Globalization;
  7. using System.Web.Mvc;
  8. using System.Web.Security;
  9. namespace EmisTerminal.Models
  10. {
  11. public class UsersContext : DbContext
  12. {
  13. public UsersContext()
  14. : base("DefaultConnection")
  15. {
  16. }
  17. public DbSet<UserProfile> UserProfiles { get; set; }
  18. }
  19. [Table("UserProfile")]
  20. public class UserProfile
  21. {
  22. [Key]
  23. [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
  24. public int UserId { get; set; }
  25. public string UserName { get; set; }
  26. }
  27. public class RegisterExternalLoginModel
  28. {
  29. [Required]
  30. [Display(Name = "User name")]
  31. public string UserName { get; set; }
  32. public string ExternalLoginData { get; set; }
  33. }
  34. public class LocalPasswordModel
  35. {
  36. [Required]
  37. [DataType(DataType.Password)]
  38. [Display(Name = "Current password")]
  39. public string OldPassword { get; set; }
  40. [Required]
  41. [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
  42. [DataType(DataType.Password)]
  43. [Display(Name = "New password")]
  44. public string NewPassword { get; set; }
  45. [DataType(DataType.Password)]
  46. [Display(Name = "Confirm new password")]
  47. [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
  48. public string ConfirmPassword { get; set; }
  49. }
  50. public class LoginModel
  51. {
  52. [Required]
  53. [Display(Name = "User name")]
  54. public string UserName { get; set; }
  55. [Required]
  56. [DataType(DataType.Password)]
  57. [Display(Name = "Password")]
  58. public string Password { get; set; }
  59. [Display(Name = "Remember me?")]
  60. public bool RememberMe { get; set; }
  61. }
  62. public class RegisterModel
  63. {
  64. [Required]
  65. [Display(Name = "User name")]
  66. public string UserName { get; set; }
  67. [Required]
  68. [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
  69. [DataType(DataType.Password)]
  70. [Display(Name = "Password")]
  71. public string Password { get; set; }
  72. [DataType(DataType.Password)]
  73. [Display(Name = "Confirm password")]
  74. [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
  75. public string ConfirmPassword { get; set; }
  76. }
  77. public class ExternalLogin
  78. {
  79. public string Provider { get; set; }
  80. public string ProviderDisplayName { get; set; }
  81. public string ProviderUserId { get; set; }
  82. }
  83. }