コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Number,ContractName,Name,Address,Latitude,Longitude,Banking,Available_bikes,Available_stands,Capacity,Status")] DublinBike bike)
        {
            if (id != bike.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bike);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DublinBikeExists(bike.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bike));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Number,Name,Address,Latitude,Longitude")] Bikes bikes)
        {
            if (id != bikes.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bikes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BikeExists(bikes.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bikes));
        }