public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TypesOfCars = await _context.TypesOfCars.FirstOrDefaultAsync(m => m.ID == id);

            if (TypesOfCars == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#2
0
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TypesOfCars1 = await _context.TypesOfCars.FirstOrDefaultAsync(m => m.ID == id);

            if (TypesOfCars1 == null)
            {
                return(NotFound());
            }
            TypesOfCars = await _context.TypesOfCars.Where(m => m.TypeofCar_ID == TypesOfCars1.ID).ToListAsync();

            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TypesOfCars = await _context.TypesOfCars.FindAsync(id);

            if (TypesOfCars != null)
            {
                _context.TypesOfCars.Remove(TypesOfCars);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }