public async Task <IActionResult> Edit(int id, [Bind("TrialBlockId,TrialBlockDescription,TrialEnd,TrialTypeId,FieldBlockId")] PtsTrialBlock ptsTrialBlock) { if (id != ptsTrialBlock.TrialBlockId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ptsTrialBlock); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PtsTrialBlockExists(ptsTrialBlock.TrialBlockId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FieldBlockId"] = new SelectList(_context.PtsFieldBlock, "FieldBlockId", "BlockChar", ptsTrialBlock.FieldBlockId); ViewData["TrialTypeId"] = new SelectList(_context.PtsTrialType, "TrialTypeId", "TrialTypeId", ptsTrialBlock.TrialTypeId); return(View(ptsTrialBlock)); }
public async Task <IActionResult> Create([Bind("TrialBlockId,TrialBlockDescription,TrialEnd,TrialTypeId,FieldBlockId")] PtsTrialBlock ptsTrialBlock) { if (ModelState.IsValid) { _context.Add(ptsTrialBlock); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FieldBlockId"] = new SelectList(_context.PtsFieldBlock, "FieldBlockId", "BlockChar", ptsTrialBlock.FieldBlockId); ViewData["TrialTypeId"] = new SelectList(_context.PtsTrialType, "TrialTypeId", "TrialTypeId", ptsTrialBlock.TrialTypeId); return(View(ptsTrialBlock)); }