Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Pesel,Age")] DrugaKlasaModel drugaKlasaModel)
        {
            if (id != drugaKlasaModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(drugaKlasaModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DrugaKlasaModelExists(drugaKlasaModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(drugaKlasaModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,PhoneNumber,Nickname,Description,Address")] DowolnaKlasaModel dowolnaKlasaModel)
        {
            if (id != dowolnaKlasaModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dowolnaKlasaModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DowolnaKlasaModelExists(dowolnaKlasaModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dowolnaKlasaModel));
        }