public async Task <IActionResult> Create([Bind("PortId,Name,IsOutput")] Port port)
        {
            if (ModelState.IsValid)
            {
                _context.Add(port);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(port));
        }
        public async Task <IActionResult> Create([Bind("ElementTypeId,Name")] ElementType elementType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(elementType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(elementType));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("SchemaId,Name")] Schema schema)
        {
            if (ModelState.IsValid)
            {
                _context.Add(schema);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(schema));
        }
        public async Task <IActionResult> Create([Bind("CombinationId,ElementTypeId,Name")] Combination combination)
        {
            if (ModelState.IsValid)
            {
                _context.Add(combination);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ElementTypeId"] = new SelectList(_context.ElementTypes, "ElementTypeId", "Name", combination.ElementTypeId);
            return(View(combination));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("CombinationPortId,CombinationId,PortId,Value")] CombinationPort combinationPort)
        {
            if (ModelState.IsValid)
            {
                _context.Add(combinationPort);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CombinationId"] = new SelectList(_context.Combinations, "CombinationId", "Name", combinationPort.CombinationId);
            ViewData["PortId"]        = new SelectList(_context.Ports, "PortId", "Name", combinationPort.PortId);
            return(View(combinationPort));
        }
        public async Task <IActionResult> Create([Bind("ElementId,Name,SchemaId,ElementTypeId")] Element element)
        {
            if (ModelState.IsValid)
            {
                _context.Add(element);
                await _context.SaveChangesAsync();

                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));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("ElementPortId,ElementId,ParentId,PortId,Name")] ElementPort elementPort)
        {
            if (ModelState.IsValid)
            {
                _context.Add(elementPort);
                await _context.SaveChangesAsync();

                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));
        }