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

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

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

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

            if (TypesOfCargo == null)
            {
                return(NotFound());
            }
            Cargos = await _context.Cargos.Where(m => m.TypesOfCargosID == TypesOfCargo.ID).ToListAsync();

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

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

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

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