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

            Kucharka = await _db.Kucharka.FirstOrDefaultAsync(m => m.Id == id);

            if (Kucharka == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Exemple #3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            Kucharka = new Kucharka();
            if (id == null)
            {
                //create
                return(Page());
            }

            //update
            Kucharka = await _db.Kucharka.FirstOrDefaultAsync(m => m.Id == id); //dtto FindAsync();

            if (Kucharka == null)
            {
                return(NotFound());
            }
            return(Page());
        }