public async Task <IActionResult> Edit(int id, [Bind("Id,MethodId,ElementaryFlowId,Factor")] CharacterisationFactor methodFactors) { if (id != methodFactors.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(methodFactors); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MethodFactorsExists(methodFactors.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ElementaryFlowId"] = new SelectList(_context.ElementaryFlows, "Id", "Name", methodFactors.ElementaryFlowId); ViewData["MethodId"] = new SelectList(_context.Set <Method>(), "Id", "Name", methodFactors.MethodId); return(View(methodFactors)); }
public async Task <IActionResult> Create([Bind("Id,MethodId,ElementaryFlowId,Factor")] CharacterisationFactor methodFactors) { if (ModelState.IsValid) { _context.Add(methodFactors); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ElementaryFlowId"] = new SelectList(_context.ElementaryFlows, "Id", "Name", methodFactors.ElementaryFlowId); ViewData["MethodId"] = new SelectList(_context.Set <Method>(), "Id", "Name", methodFactors.MethodId); return(View(methodFactors)); }