添加 ViewModel

首先,我们需要创建一个 ViewModel。创建一个新文件夹/ Models / Account,并将文件 MemberLoginViewModel.cs 添加到该文件夹​​中。

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace MyCMS.Models.Account
{
    public class MemberLoginViewModel
    {
        [Required]
        [EmailAddress]
        [Display(Name = "Email")]
        public string Email { get; set; }
        
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Display(Name = "Remember me?")]
        public bool RememberMe { get; set; }
    }
}