public async Task <IActionResult> Edit(int id, [Bind("CombinationId,ElementTypeId,Name")] Combination combination)
        {
            if (id != combination.CombinationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(combination);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CombinationExists(combination.CombinationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ElementTypeId"] = new SelectList(_context.ElementTypes, "ElementTypeId", "Name", combination.ElementTypeId);
            return(View(combination));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PortId,Name,IsOutput")] Port port)
        {
            if (id != port.PortId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(port);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PortExists(port.PortId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(port));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ElementPortId,ElementId,ParentId,PortId,Name")] ElementPort elementPort)
        {
            if (id != elementPort.ElementPortId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(elementPort);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ElementPortExists(elementPort.ElementPortId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ElementId"] = new SelectList(_context.Elements, "ElementId", "Name", elementPort.ElementId);
            ViewData["ParentId"]  = new SelectList(_context.ElementPorts.Where(ep => ep.Port.IsOutput).ToList(), "ElementPortId", "Name", elementPort.ParentId);
            ViewData["PortId"]    = new SelectList(_context.Ports, "PortId", "Name", elementPort.PortId);
            return(View(elementPort));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ElementTypeId,Name")] ElementType elementType)
        {
            if (id != elementType.ElementTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(elementType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ElementTypeExists(elementType.ElementTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(elementType));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ElementId,Name,SchemaId,ElementTypeId")] Element element)
        {
            if (id != element.ElementId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(element);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ElementExists(element.ElementId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ElementTypeId"] = new SelectList(_context.ElementTypes, "ElementTypeId", "Name", element.ElementTypeId);
            ViewData["SchemaId"]      = new SelectList(_context.Scheme, "SchemaId", "Name", element.SchemaId);
            return(View(element));
        }
Example #6
0
        public async Task <IActionResult> Edit(int id, [Bind("SchemaId,Name")] Schema schema)
        {
            if (id != schema.SchemaId)
            {
                return(NotFound());
            }

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