public IHttpActionResult PostCardhistory(Cardhistory cardhistory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CardsH.Add(cardhistory); try { db.SaveChanges(); } catch (DbUpdateException) { if (CardhistoryExists(cardhistory.ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = cardhistory.ID }, cardhistory)); }
public IHttpActionResult PutCardhistory(string id, Cardhistory cardhistory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cardhistory.ID) { return(BadRequest()); } db.Entry(cardhistory).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CardhistoryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetCardhistory(string id) { Cardhistory cardhistory = db.CardsH.Find(id); if (cardhistory == null) { return(NotFound()); } return(Ok(cardhistory)); }
public IHttpActionResult DeleteCardhistory(string id) { Cardhistory cardhistory = db.CardsH.Find(id); if (cardhistory == null) { return(NotFound()); } db.CardsH.Remove(cardhistory); db.SaveChanges(); return(Ok(cardhistory)); }