Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("id,number,pole,available_bikes,code_insee,lng,availability,availabilitycode,etat,startdate,langue,bike_stands,last_update,available_bike_stands,gid,titre,status,commune,description,nature,bonus,address2,address,lat,last_update_fme,enddate,name,banking,nmarrond")] Stations stations)
        {
            if (id != stations.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stations);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StationsExists(stations.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(stations));
        }
Exemple #2
0
        public IActionResult Put([FromBody] GasStation station)
        {
            if (station == null)
            {
                return(BadRequest());
            }
            if (!db.Station.Any(x => x.Id == station.Id))
            {
                return(NotFound());
            }

            db.Update(station);
            db.SaveChanges();
            return(Ok(station));
        }
Exemple #3
0
        public async Task <ActionResult <Developer> > Put(Developer developer)
        {
            if (developer == null)
            {
                return(BadRequest());
            }

            if (!db.Developers.Any(d => d.Id == developer.Id))
            {
                return(NotFound());
            }

            db.Update(developer);
            await db.SaveChangesAsync();

            return(Ok(developer));
        }
        public async Task <ActionResult <Post> > Put(Post post)
        {
            if (post == null)
            {
                return(BadRequest());
            }

            if (!db.Posts.Any(p => p.Id == post.Id))
            {
                return(NotFound());
            }

            db.Update(post);
            await db.SaveChangesAsync();

            return(Ok(post));
        }
        public async Task <ActionResult <Platform> > Put(Platform platform)
        {
            if (platform == null)
            {
                return(BadRequest());
            }

            if (!db.Platforms.Any(p => p.Id == platform.Id))
            {
                return(NotFound());
            }

            db.Update(platform);
            await db.SaveChangesAsync();

            return(Ok(platform));
        }
Exemple #6
0
        public async Task <ActionResult <Game> > Put(Game game)
        {
            if (game == null)
            {
                return(BadRequest());
            }

            if (!db.Games.Any(g => g.Id == game.Id))
            {
                return(NotFound());
            }

            db.Update(game);
            await db.SaveChangesAsync();

            return(Ok(game));
        }
Exemple #7
0
        public async Task <ActionResult <Country> > Put(Country country)
        {
            if (country == null)
            {
                return(BadRequest());
            }

            if (!db.Countries.Any(c => c.Id == country.Id))
            {
                return(NotFound());
            }

            db.Update(country);
            await db.SaveChangesAsync();

            return(Ok(country));
        }