예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Process Process)
        {
            if (id != Process.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(Process);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProcessMetaExists(Process.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(Process));
        }
        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> 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));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Compartment compartment)
        {
            if (id != compartment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(compartment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompartmentExists(compartment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(compartment));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CompartmentId,SubCompartmentId,UnitId")] ElementaryFlow elementaryFlow)
        {
            if (id != elementaryFlow.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(elementaryFlow);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ElementaryFlowExists(elementaryFlow.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompartmentId"]    = new SelectList(_context.Compartments, "Id", "Name", elementaryFlow.CompartmentId);
            ViewData["SubCompartmentId"] = new SelectList(_context.SubCompartments, "Id", "Name", elementaryFlow.SubCompartmentId);
            ViewData["UnitId"]           = new SelectList(_context.Units, "Id", "Name", elementaryFlow.UnitId);
            return(View(elementaryFlow));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Unit")] Method methodHeader)
        {
            if (id != methodHeader.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(methodHeader);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MethodHeaderExists(methodHeader.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(methodHeader));
        }