public IHttpActionResult PutCantanteSongs(int id, CantanteSongs cantanteSongs) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cantanteSongs.idInter) { return(BadRequest()); } db.Entry(cantanteSongs).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CantanteSongsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetCantanteSongs(int id) { CantanteSongs cantanteSongs = db.CantanteSongs.Find(id); if (cantanteSongs == null) { return(NotFound()); } return(Ok(cantanteSongs)); }
public IHttpActionResult PostCantanteSongs(CantanteSongs cantanteSongs) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CantanteSongs.Add(cantanteSongs); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = cantanteSongs.idInter }, cantanteSongs)); }
public IHttpActionResult DeleteCantanteSongs(int id) { CantanteSongs cantanteSongs = db.CantanteSongs.Find(id); if (cantanteSongs == null) { return(NotFound()); } db.CantanteSongs.Remove(cantanteSongs); db.SaveChanges(); return(Ok(cantanteSongs)); }