예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FixtureID,ControllerFunctionID,Description,MultiChannel")] FixtureFunction fixtureFunction)
        {
            if (id != fixtureFunction.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(fixtureFunction);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FixtureFunctionExists(fixtureFunction.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ControllerFunctionID"] = new SelectList(_context.ControllerFunctions, "ID", "Name", fixtureFunction.ControllerFunctionID);
            ViewData["FixtureID"]            = new SelectList(_context.Fixtures, "ID", "ID", fixtureFunction.FixtureID);
            return(View(fixtureFunction));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("ID,FixtureID,ControllerFunctionID,Description,MultiChannel")] FixtureFunction fixtureFunction)
        {
            if (ModelState.IsValid)
            {
                _context.Add(fixtureFunction);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ControllerFunctionID"] = new SelectList(_context.ControllerFunctions, "ID", "Name", fixtureFunction.ControllerFunctionID);
            ViewData["FixtureID"]            = new SelectList(_context.Fixtures, "ID", "ID", fixtureFunction.FixtureID);
            return(View(fixtureFunction));
        }