public async Task <IActionResult> Edit(int id, SubsidencePoint subsidencePoint) { if (id != subsidencePoint.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subsidencePoint); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubsidencePointExists(subsidencePoint.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } subsidencePoint.Countries = GetCountries(); subsidencePoint.Regions = GetRegions(); subsidencePoint.DataTypes = GetDataTypes(); subsidencePoint.Cities = GetCities(); return(View(subsidencePoint)); }
// GET: SubsidencePoints/Create public IActionResult Create() { var model = new SubsidencePoint(); model.Countries = GetCountries(); model.Regions = GetRegions(); model.DataTypes = GetDataTypes(); model.Cities = GetCities(); return(View(model)); }
public async Task <IActionResult> Create(SubsidencePoint subsidencePoint) { if (ModelState.IsValid) { _context.Add(subsidencePoint); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } subsidencePoint.Countries = GetCountries(); subsidencePoint.Regions = GetRegions(); subsidencePoint.DataTypes = GetDataTypes(); subsidencePoint.Cities = GetCities(); return(View(subsidencePoint)); }