Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("VKey,Name,NickName,Age,Ethnicity,Email,PhoneNumber")] Volunteer volunteer)
        {
            if (id != volunteer.VKey)
            {
                return(NotFound());
            }

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