public async Task <IActionResult> Edit(int id, [Bind("weatherinfoId,date,clocktime,temperature,humidity,airpressure")] Weatherinfo weatherinfo) { if (id != weatherinfo.weatherinfoId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(weatherinfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WeatherinfoExists(weatherinfo.weatherinfoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(weatherinfo)); }
public async Task <IActionResult> Create([Bind("date,clocktime,temperature,humidity,airpressure")] Weatherinfo weatherinfo) { if (ModelState.IsValid) { _context.Add(weatherinfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(weatherinfo)); }