public async Task<IActionResult> Edit(int id, [Bind("BioNoteId,BioSampleId,NoteBody")] BioSamplesNote bioSamplesNote) { if (id != bioSamplesNote.BioNoteId) { return NotFound(); } if (ModelState.IsValid) { try { _context.Update(bioSamplesNote); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BioSamplesNoteExists(bioSamplesNote.BioNoteId)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } ViewData["BioSampleId"] = new SelectList(_context.BiologicalSamples, "BioSampleId", "BioSampleId", bioSamplesNote.BioSampleId); return View(bioSamplesNote); }
public async Task<IActionResult> Create([Bind("BioNoteId,BioSampleId,NoteBody")] BioSamplesNote bioSamplesNote) { if (ModelState.IsValid) { _context.Add(bioSamplesNote); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } ViewData["BioSampleId"] = new SelectList(_context.BiologicalSamples, "BioSampleId", "BioSampleId", bioSamplesNote.BioSampleId); return View(bioSamplesNote); }