Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,State,City")] SelectedCityState selectedCityState)
        {
            if (id != selectedCityState.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(selectedCityState);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SelectedCityStateExists(selectedCityState.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(selectedCityState));
        }
Ejemplo n.º 2
0
        // GET: SelectedCityStates/Create
        public IActionResult Create()
        {
            SelectedCityState selectedCityStateToEdit = new SelectedCityState();

            SetStateCityViewBags();
            return(View(selectedCityStateToEdit));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,State,City")] SelectedCityState selectedCityState)
        {
            if (ModelState.IsValid)
            {
                _context.Add(selectedCityState);
                await _context.SaveChangesAsync();

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