public async Task <IActionResult> Edit(string id, [Bind("SensorID,TreeSort,LocationID,CoordinateIat,CoordinateIon")] TreeSensorModel treeSensorModel) { if (id != treeSensorModel.SensorID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(treeSensorModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TreeSensorModelExists(treeSensorModel.SensorID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(treeSensorModel)); }
public async Task <IActionResult> Create([Bind("SensorID,TreeSort,LocationID,CoordinateIat,CoordinateIon")] TreeSensorModel treeSensorModel) { if (ModelState.IsValid) { _context.Add(treeSensorModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(treeSensorModel)); }