Beispiel #1
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(PhoneBook).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PhoneBookExists(PhoneBook.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Grouping.Add(Grouping);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Beispiel #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Beispiel #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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