public IHttpActionResult PutGunAutomatic(int id, GunAutomatic gunAutomatic) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != gunAutomatic.GunAutomaticID) { return(BadRequest()); } db.Entry(gunAutomatic).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GunAutomaticExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetGunAutomatic(int id) { GunAutomatic gunAutomatic = db.GunAutomatics.Find(id); if (gunAutomatic == null) { return(NotFound()); } return(Ok(gunAutomatic)); }
public IHttpActionResult PostGunAutomatic(GunAutomatic gunAutomatic) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.GunAutomatics.Add(gunAutomatic); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = gunAutomatic.GunAutomaticID }, gunAutomatic)); }
// Start is called before the first frame update void Start() { weaponAnimator = this.GetComponent <Animator>(); gunAutomaticRef = this.GetComponent <GunAutomatic>(); }