public async Task <IActionResult> PutWeatherReport(Guid id, WeatherReport weatherReport) { if (id != weatherReport.WeatherReportId) { return(BadRequest()); } _context.Entry(weatherReport).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WeatherReportExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("ID,City,Temp,WeatherTime")] Models.WearherReport wearherReport) { if (ModelState.IsValid) { _context.Add(wearherReport); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(wearherReport)); }