예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Type,Number,IndividualId")] Phone phone)
        {
            if (id != phone.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(phone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PhoneExists(phone.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Edit), "Individuals", new { id = phone.IndividualId }));
            }
            return(View(phone));
        }
 public async Task Update(Individual individual)
 {
     _db.Update(individual);
     await _db.SaveChangesAsync();
 }