コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,LocationName,LocationType,Choice,Yes,No")] RunningSpot runningSpot)
        {
            if (ModelState.IsValid)
            {
                _context.Add(runningSpot);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(runningSpot));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Address,Lat,Lng,Type")] Map map)
        {
            if (ModelState.IsValid)
            {
                _context.Add(map);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Runningspot, "Id", "Choice", map.Id);
            return(View(map));
        }