public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } ParentParameter = await _context.ParentParameter.Include(m => m.Parameters).FirstOrDefaultAsync(m => m.ParentParameterId == id); if (ParentParameter == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } ParentParameter = await _context.ParentParameter.FindAsync(id); if (ParentParameter != null) { _context.ParentParameter.Remove(ParentParameter); await _context.SaveChangesAsync(); } var user = await _userManager.GetUserAsync(User); logger.Info("{user} deleted ParentParameter {ppName} carrying - id {ppId} on {date}", user.Email, ParentParameter.ParentParameterName, ParentParameter.ParentParameterId, DateTime.Now); return(RedirectToPage("../Parameters")); }