public async Task <IActionResult> PutSongReqModel([FromRoute] int id, [FromBody] SongReqModel songReqModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != songReqModel.Id) { return(BadRequest()); } _context.Entry(songReqModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SongReqModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostSongReqModel([FromForm] SongReqModel songReqModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.SongReqModel.Add(songReqModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSongReqModel", new { id = songReqModel.Id }, songReqModel)); }