美文网首页
MVC @model用法

MVC @model用法

作者: 佛系码农 | 来源:发表于2018-06-28 19:23 被阅读0次

1、创建Model实体

public class People

    {

        public  string Name { get; set; }

        public  int Age { get; set; }

        public int Weight { get; set; }

    }

2、利用PartialView返回给前端一个Model

public PartialViewResult GetPeopleInfo()

        {

            var peopelInfo = new People

            {

                Name = "henry",

                Age = 18,

                Weight = 80

            };

            return PartialView("PeopleInfo", peopelInfo);

        }

3、前端绑定Model实现:

相关文章

网友评论

      本文标题:MVC @model用法

      本文链接:https://www.haomeiwen.com/subject/ssoaqftx.html