コード例 #1
0
ファイル: Delete.cshtml.cs プロジェクト: heena2000/cricbuzz
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            OdiRanking = await _context.OdiRankings
                         .Include(o => o.Country).FirstOrDefaultAsync(m => m.Id == id);

            if (OdiRanking == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            OdiRanking = await _context.OdiRankings
                         .Include(o => o.Country).FirstOrDefaultAsync(m => m.Id == id);

            if (OdiRanking == null)
            {
                return(NotFound());
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "CountryName");
            return(Page());
        }
コード例 #3
0
ファイル: Delete.cshtml.cs プロジェクト: heena2000/cricbuzz
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            OdiRanking = await _context.OdiRankings.FindAsync(id);

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

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