public IHttpActionResult PutShooterEventCompetition(int id, ShooterEventCompetition shooterEventCompetition) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != shooterEventCompetition.Id) { return(BadRequest()); } db.Entry(shooterEventCompetition).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ShooterEventCompetitionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostShooterEventCompetition(ShooterEventCompetition shooterEventCompetition) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ShootersEventCompetition.Add(shooterEventCompetition); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = shooterEventCompetition.Id }, shooterEventCompetition)); }
public IHttpActionResult DeleteShooterEventCompetition(int id) { ShooterEventCompetition shooterEventCompetition = db.ShootersEventCompetition.Find(id); if (shooterEventCompetition == null) { return(NotFound()); } db.ShootersEventCompetition.Remove(shooterEventCompetition); db.SaveChanges(); return(Ok(shooterEventCompetition)); }