示例#1
0
        public async Task <IActionResult> Create([Bind("Id,Title,Latitude,Longitude")] RiskAssessment riskAssessment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(riskAssessment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(riskAssessment));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Title,Level,RiskAssessmentId")] Threat threat)
        {
            if (ModelState.IsValid)
            {
                _context.Add(threat);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RiskAssessmentId"] = new SelectList(_context.RiskAssessments, "Id", "Id", threat.RiskAssessmentId);
            return(View(threat));
        }