Beispiel #1
0
        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));
        }
Beispiel #2
0
        public IHttpActionResult GetGunAutomatic(int id)
        {
            GunAutomatic gunAutomatic = db.GunAutomatics.Find(id);

            if (gunAutomatic == null)
            {
                return(NotFound());
            }

            return(Ok(gunAutomatic));
        }
Beispiel #3
0
        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>();
 }