MVC中使用viewmodel

新建一个类在类中写

public class DataViewmodel
    {

        public List<users> usersmodel { get; set; }
        public List<luntan> luntanmodel { get; set; }
        public List<dongtai > dongtaimodel { get; set; }
        public List<production> productionmodel { get; set; }

        public DataViewmodel(List<Models.users> userlsit,List<luntan> luntanlist,List<dongtai> dongtailist,List<production> productionlist) {
            this.usersmodel = userlsit;
            this.luntanmodel = luntanlist;
            this.dongtaimodel = dongtailist;
            this.productionmodel = productionlist;
        }   

控制器中以此为model写就好

 

posted @ 2019-04-16 14:01  大黄人  阅读(739)  评论(0编辑  收藏  举报