public IHttpActionResult Postv_top5(v_top5 v_top5) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.v_top5.Add(v_top5); try { db.SaveChanges(); } catch (DbUpdateException) { if (v_top5Exists(v_top5.IdDisco)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = v_top5.IdDisco }, v_top5)); }
public IHttpActionResult Putv_top5(int id, v_top5 v_top5) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != v_top5.IdDisco) { return(BadRequest()); } db.Entry(v_top5).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!v_top5Exists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getv_top5(int id) { v_top5 v_top5 = db.v_top5.Find(id); if (v_top5 == null) { return(NotFound()); } return(Ok(v_top5)); }
public IHttpActionResult Deletev_top5(int id) { v_top5 v_top5 = db.v_top5.Find(id); if (v_top5 == null) { return(NotFound()); } db.v_top5.Remove(v_top5); db.SaveChanges(); return(Ok(v_top5)); }