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

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

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

            return(RedirectToPage("./Index"));
        }
コード例 #2
0
ファイル: Details.cshtml.cs プロジェクト: BoboBH/Demo
        public async Task <IActionResult> OnGetAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SMCPromotion = await _context.SMCPromotion
                           .Include(s => s.Activity)
                           .Include(s => s.Channel)
                           .Include(s => s.Owner).SingleOrDefaultAsync(m => m.Id == id);

            if (SMCPromotion == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #3
0
        public async Task <IActionResult> OnGetAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SMCPromotion = await _context.SMCPromotion
                           .Include(s => s.Activity)
                           .Include(s => s.Channel)
                           .Include(s => s.Owner).SingleOrDefaultAsync(m => m.Id == id);

            if (SMCPromotion == null)
            {
                return(NotFound());
            }
            ViewData["ActivityId"] = new SelectList(_context.SMCActivity, "Id", "Name");
            ViewData["ChannelId"]  = new SelectList(_context.SMCChannel, "Id", "Name");
            ViewData["OwnerId"]    = new SelectList(_context.ApplicationUser, "Id", "UserName");
            return(Page());
        }