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

            DoNotContactPhone = await _context.DoNotContactPhones
                                .Include(d => d.Publisher).FirstOrDefaultAsync(m => m.DoNotContactPhoneId == id);

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

            DoNotContactPhone = await _context.DoNotContactPhones.FindAsync(id);

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

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