public async Task <IActionResult> Edit(int id, [Bind("ResultFormatId,ResultFormatTitle,ResultFormatDescription,TrialBlockId,UnitTypeId")] PtsResultFormat ptsResultFormat) { if (id != ptsResultFormat.ResultFormatId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ptsResultFormat); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PtsResultFormatExists(ptsResultFormat.ResultFormatId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TrialBlockId"] = new SelectList(_context.PtsTrialBlock, "TrialBlockId", "TrialBlockId", ptsResultFormat.TrialBlockId); ViewData["UnitTypeId"] = new SelectList(_context.PtsUnitType, "UnitTypeId", "UnitTypeName", ptsResultFormat.UnitTypeId); return(View(ptsResultFormat)); }
public async Task <IActionResult> Create([Bind("ResultFormatId,ResultFormatTitle,ResultFormatDescription,TrialBlockId,UnitTypeId")] PtsResultFormat ptsResultFormat) { if (ModelState.IsValid) { _context.Add(ptsResultFormat); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TrialBlockId"] = new SelectList(_context.PtsTrialBlock, "TrialBlockId", "TrialBlockId", ptsResultFormat.TrialBlockId); ViewData["UnitTypeId"] = new SelectList(_context.PtsUnitType, "UnitTypeId", "UnitTypeName", ptsResultFormat.UnitTypeId); return(View(ptsResultFormat)); }