新增 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; }
    }
}