public async Task <IActionResult> OnPostAsync(int?id) { if (id is not null) { Home = await DataContext.HomeReviewHomes.FirstOrDefaultAsync(r => r.Id == id); } if (Home is null) { return(NotFound()); } DataContext.Remove(Home); await DataContext.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id is not null) { Home = await DataContext.HomeReviewHomes .Include(h => h.CreatedBy) .Include(h => h.ModifiedBy) .FirstOrDefaultAsync(m => m.Id == id); } if (Home is null) { return(NotFound()); } return(Page()); }