public IActionResult Index()
        {
            List <Actor> actors = new List <Actor>
            {
                new Actor
                {
                    Firstname = "Meryl",
                    Lastname  = "Streep",
                    Films     = 20
                },
                new Actor
                {
                    Firstname = "Bobcat",
                    Lastname  = "Goldthwaite",
                    Films     = 2
                },
                new Actor
                {
                    Firstname = "Steve",
                    Lastname  = "Guttenberg",
                    Films     = 5
                }
            };

            var vm = new ActorListViewModel
            {
                Actors = actors
            };

            ViewData["actors"] = actors;
            // return View(vm);
            return(View());
        }
示例#2
0
 public ActorList()
 {
     //Setting BindingContext
     ViewModel = new ActorListViewModel();
     InitializeComponent();
 }