Пример #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

            if (KindOfWork == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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