Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Level,RiskAssessmentId")] Threat threat)
        {
            if (id != threat.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(threat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ThreatExists(threat.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RiskAssessmentId"] = new SelectList(_context.RiskAssessments, "Id", "Id", threat.RiskAssessmentId);
            return(View(threat));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Latitude,Longitude")] RiskAssessment riskAssessment)
        {
            if (id != riskAssessment.Id)
            {
                return(NotFound());
            }

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