public ActionResult Index()
        {
            var viewModel = new StudentsIndexViewModel
            {
                Student = new Student
                {
                    Name         = "Pelajar 2",
                    IcNumber     = "121212121212",
                    MatricNumber = "A1234567890"
                },
                Payments = new List <Payment>
                {
                    new Payment
                    {
                        Amount      = 100,
                        Description = "Yuran Pendaftaran"
                    },
                    new Payment
                    {
                        Amount      = 200,
                        Description = "Yuran Penilaian"
                    },
                    new Payment
                    {
                        Amount      = 300,
                        Description = "Yuran Peperiksaan"
                    },
                }
            };

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            //show a list of students
            StudentsIndexViewModel studentsIndexViewModel
                = new StudentsIndexViewModel();

            studentsIndexViewModel.Students = new List <StudentsShowInfoViewModel>();
            foreach (var student in await _schoolDbContext
                     .Students
                     .ToListAsync())
            {
                studentsIndexViewModel.Students
                .Add
                (
                    new StudentsShowInfoViewModel
                {
                    Id    = student.Id,
                    Name  = $"{student.Firstname} {student.Lastname}",
                    Image = student.Image
                }
                );
            }
            return(View(studentsIndexViewModel));
        }