Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,LocationName,LocationType,Choice,Yes,No")] RunningSpot runningSpot)
        {
            if (id != runningSpot.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(runningSpot);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RunningSpotExists(runningSpot.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(runningSpot));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address,Lat,Lng,Type")] Map map)
        {
            if (id != map.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(map);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MapExists(map.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Runningspot, "Id", "Choice", map.Id);
            return(View(map));
        }