public async Task <IActionResult> PutWheatherDato(int id, WheatherDato wheatherDato) { if (id != wheatherDato.WheatherDatoID) { return(BadRequest()); } _context.Entry(wheatherDato).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WheatherDatoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <WheatherDato> > PostWheatherDato(WheatherDato wheatherDato) { _context.WheatherDato.Add(wheatherDato); await _context.SaveChangesAsync(); if (_hubContext != null) { string JSON = JsonSerializer.Serialize(wheatherDato); await _hubContext.Clients.All.SendAsync("ReceiveMessage", JSON); } return(CreatedAtAction("GetWheatherDato", new { id = wheatherDato.WheatherDatoID }, wheatherDato)); }