public IHttpActionResult PostTicgame(Ticgame ticgame) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Ticgames.Add(ticgame); try { db.SaveChanges(); } catch (DbUpdateException) { if (TicgameExists(ticgame.Email)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = ticgame.Email }, ticgame)); }
public IHttpActionResult PutTicgame(string id, Ticgame ticgame) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ticgame.Email) { return(BadRequest()); } db.Entry(ticgame).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TicgameExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTicgame(string id) { Ticgame ticgame = db.Ticgames.Find(id); if (ticgame == null) { return(NotFound()); } return(Ok(ticgame)); }
public IHttpActionResult DeleteTicgame(string id) { Ticgame ticgame = db.Ticgames.Find(id); if (ticgame == null) { return(NotFound()); } db.Ticgames.Remove(ticgame); db.SaveChanges(); return(Ok(ticgame)); }