// 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(Experiment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExperimentExists(Experiment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// 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.Experiment.Add(Experiment); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Experiment = await _context.Experiment.FindAsync(id); if (Experiment != null) { _context.Experiment.Remove(Experiment); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Schedule = await _context.Schedule.FindAsync(id); if (Schedule != null) { _context.Schedule.Remove(Schedule); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
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")); }