public async Task <IActionResult> PutCampaign([FromRoute] int id, [FromBody] Campaign campaign) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != campaign.Id) { return(BadRequest()); } _context.Entry(campaign).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CampaignExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }