public async Task <IActionResult> Edit(int id, [Bind("Id,CityId,Title,Address,Phone")] CityPoints cityPoints)
        {
            if (id != cityPoints.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cityPoints);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CityPointsExists(cityPoints.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cityPoints));
        }
Beispiel #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
        public async Task <IActionResult> Create([Bind("Id,CityId,Title,Address,Phone")] CityPoints cityPoints)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cityPoints);
                await _context.SaveChangesAsync();

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