public async Task <IActionResult> PutSpeaker([FromRoute] int id, [FromBody] Speaker speaker) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != speaker.Id) { return(BadRequest()); } _context.Entry(speaker).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpeakerExists(id)) { return(NotFound()); } else { throw; } } return(Ok($"Updated user - {speaker.FirstName} {speaker.LastName}")); //return NoContent(); }
public async Task<IActionResult> PutTag([FromRoute] int id, [FromBody] Tag tag) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != tag.Id) { return BadRequest(); } _context.Entry(tag).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TagExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }
public async Task <IActionResult> PutEvent([FromRoute] int id, [FromBody] Event @event) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != @event.Id) { return(BadRequest()); } _context.Entry(@event).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }