public IHttpActionResult PutAspNetAuctions(int id, AspNetAuctions aspNetAuctions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != aspNetAuctions.Id) { return(BadRequest()); } db.Entry(aspNetAuctions).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AspNetAuctionsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetAspNetAuctions(int id) { AspNetAuctions aspNetAuctions = db.AspNetAuctions.Find(id); if (aspNetAuctions == null) { return(NotFound()); } return(Ok(aspNetAuctions)); }
public IHttpActionResult PostAspNetAuctions(AspNetAuctions aspNetAuctions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AspNetAuctions.Add(aspNetAuctions); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = aspNetAuctions.Id }, aspNetAuctions)); }
public IHttpActionResult DeleteAspNetAuctions(int id) { AspNetAuctions aspNetAuctions = db.AspNetAuctions.Find(id); if (aspNetAuctions == null) { return(NotFound()); } db.AspNetAuctions.Remove(aspNetAuctions); db.SaveChanges(); return(Ok(aspNetAuctions)); }