我是新來MVC5,只是想掌握使用的ViewModels的。我的問題是如果我必須在我的ViewModel的控制器中實例化我的模型類。我正在製作一個數據庫來組織賬單,並且有一個映射到數據庫表的Cash模型和一個用於查看/編輯數據的CashViewModel。 這裏是我的模型: public class Cash
{
public int CashId { get; set; }
我想提出一個視圖模型首次,一些研究之後,我得到了下面的代碼: using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HotelWP