Beispiel #1
0
        public async Task <IHttpActionResult> Putcountrys(int id, countrys countrys)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != countrys.id)
            {
                return(BadRequest());
            }

            db.Entry(countrys).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!countrysExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> Getcountrys(int id)
        {
            countrys countrys = await db.countrys.FindAsync(id);

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

            return(Ok(countrys));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> Postcountrys(countrys countrys)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.countrys.Add(countrys);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = countrys.id }, countrys));
        }
Beispiel #4
0
        public async Task <IHttpActionResult> Deletecountrys(int id)
        {
            countrys countrys = await db.countrys.FindAsync(id);

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

            db.countrys.Remove(countrys);
            await db.SaveChangesAsync();

            return(Ok(countrys));
        }
    //pour créer ou updater la liste de pays (en cas de mise à jour et d'ajout de pays)
    public void updateVictoryWithCountry()
    {
        country = new countrys();

        foreach(string countryInst in country.countryList)
        {

            if(!victoryList.ContainsKey(countryInst))
            {
                //Debug.Log ("test");
                victoryList.Add(countryInst, "Not defended yet");

            }

        }
    }