public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(WeatherStats).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WeatherStatsExists(WeatherStats.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.WeatherStats.Add(WeatherStats); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } WeatherStats = await _context.WeatherStats.FindAsync(id); if (WeatherStats != null) { _context.WeatherStats.Remove(WeatherStats); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }