Ejemplo n.º 1
0
    public async Task <IActionResult> OnPostAsync(int?id)
    {
        if (id == null)
        {
            return(NotFound());
        }

        Book = await _context.Books !.FindAsync(id);

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

        return(RedirectToPage("./Index"));
    }
Ejemplo n.º 2
0
    public async Task <IActionResult> OnPostAsync(int?id)
    {
        if (id == null)
        {
            return(NotFound());
        }

        MemberSubscriptionPlan = await _context.MemberSubscriptionPlan !.FindAsync(id);

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

        return(RedirectToPage("./Index"));
    }
Ejemplo n.º 3
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(Book).State = EntityState.Modified;

        try
        {
            await _context.SaveChangesAsync();
        }
        catch (DbUpdateConcurrencyException)
        {
            if (!BookExists(Book !.Id))
            {
                return(NotFound());
            }