public async Task <IActionResult> Edit(int id, [Bind("Id,ProcessId,ElementaryFlowId,Value")] ProcessExchanges processExchanges) { if (id != processExchanges.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(processExchanges); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProcessExchangesExists(processExchanges.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ElementaryFlowId"] = new SelectList(_context.ElementaryFlows, "Id", "Name", processExchanges.ElementaryFlowId); ViewData["ProcessId"] = new SelectList(_context.Processes, "Id", "Name", processExchanges.ProcessId); return(View(processExchanges)); }
public async Task <IActionResult> Create([Bind("Id,ProcessId,ElementaryFlowId,Value")] ProcessExchanges processExchanges) { if (ModelState.IsValid) { _context.Add(processExchanges); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ElementaryFlowId"] = new SelectList(_context.ElementaryFlows, "Id", "Name", processExchanges.ElementaryFlowId); ViewData["ProcessId"] = new SelectList(_context.Processes, "Id", "Name", processExchanges.ProcessId); return(View(processExchanges)); }