﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Library1.Models;
using WebApplication1.Models;

namespace TestProject
{
    public class IndexModel : PageModel
    {
        private readonly WebApplication1.Models.CarContext _context;

        public IndexModel(WebApplication1.Models.CarContext context)
        {
            _context = context;
        }

        public IList<Car> Car { get;set; }

        public async Task OnGetAsync()
        {
            Car = await _context.Car
                .Include(c => c.Manufacturer).ToListAsync();
        }
    }
}
