public async Task <IActionResult> OnGetAsync(int?experimentId, int?participantId) { if (experimentId == null) { return(NotFound()); } ExperimentParticipant = await _context.ExperimentParticipant .Include(e => e.Experiment) .Include(e => e.Participant) .Where(m => m.ExperimentId == experimentId) .Where(m => m.ParticipantId == participantId) .SingleOrDefaultAsync(); if (ExperimentParticipant == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?experimentId, int participantId) { if (experimentId == null) { return(NotFound()); } ExperimentParticipant = await _context.ExperimentParticipant .Include(e => e.Experiment) .Include(e => e.Participant) .Where(m => m.ExperimentId == experimentId) .Where(m => m.ParticipantId == participantId) .SingleOrDefaultAsync(); if (ExperimentParticipant != null) { _context.ExperimentParticipant.Remove(ExperimentParticipant); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }