PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/MvcMusicStore/Models/AccountModels.cs

#
C# | 67 lines | 56 code | 11 blank | 0 comment | 0 complexity | d4a8a2fccab44af915e1c841c5c925e1 MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel.DataAnnotations;
 4using System.Globalization;
 5using System.Web.Mvc;
 6using System.Web.Security;
 7
 8namespace Mvc3ToolsUpdateWeb_Default.Models
 9{
10
11    public class ChangePasswordModel
12    {
13        [Required]
14        [DataType(DataType.Password)]
15        [Display(Name = "Current password")]
16        public string OldPassword { get; set; }
17
18        [Required]
19        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
20        [DataType(DataType.Password)]
21        [Display(Name = "New password")]
22        public string NewPassword { get; set; }
23
24        [DataType(DataType.Password)]
25        [Display(Name = "Confirm new password")]
26        [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
27        public string ConfirmPassword { get; set; }
28    }
29
30    public class LogOnModel
31    {
32        [Required]
33        [Display(Name = "User name")]
34        public string UserName { get; set; }
35
36        [Required]
37        [DataType(DataType.Password)]
38        [Display(Name = "Password")]
39        public string Password { get; set; }
40
41        [Display(Name = "Remember me?")]
42        public bool RememberMe { get; set; }
43    }
44
45    public class RegisterModel
46    {
47        [Required]
48        [Display(Name = "User name")]
49        public string UserName { get; set; }
50
51        [Required]
52        [DataType(DataType.EmailAddress)]
53        [Display(Name = "Email address")]
54        public string Email { get; set; }
55
56        [Required]
57        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
58        [DataType(DataType.Password)]
59        [Display(Name = "Password")]
60        public string Password { get; set; }
61
62        [DataType(DataType.Password)]
63        [Display(Name = "Confirm password")]
64        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
65        public string ConfirmPassword { get; set; }
66    }
67}