コード例 #1
0
        public async Task <IActionResult> Create([Bind("HeldId,HeldName,HeldEigenschaft")] Held held)
        {
            if (ModelState.IsValid)
            {
                _context.Add(held);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(held));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("AgressorId,AgressorName,AgressorEigenschaft")] Agressor agressor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(agressor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(agressor));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("BedrohungId,HeldId,AgressorId,Bedrohungsbezeichnung")] Bedrohung bedrohung)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bedrohung);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AgressorId"] = new SelectList(_context.Agressors, "AgressorId", "AgressorEigenschaft", bedrohung.AgressorId);
            ViewData["HeldId"]     = new SelectList(_context.Helds, "HeldId", "HeldEigenschaft", bedrohung.HeldId);
            return(View(bedrohung));
        }