コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Establishment,Address,DateTime,Thoughts")] SouthLocations southLocations)
        {
            if (id != southLocations.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(southLocations);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SouthLocationsExists(southLocations.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(southLocations));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Establishment,Address,DateTime,Thoughts")] SouthLocations southLocations)
        {
            if (ModelState.IsValid)
            {
                _context.Add(southLocations);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(southLocations));
        }