public async Task <IActionResult> PutPerson(int id, Person person)
        {
            if (id != person.PersonId)
            {
                return(BadRequest());
            }

            _context.Entry(person).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PersonExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult> Update(int id, Person person)
        {
            if (id != person.PersonId)
            {
                return(BadRequest());
            }

            _azureDbContext.Entry(person).State = EntityState.Modified;

            await _azureDbContext.SaveChangesAsync();

            return(NoContent());
        }
예제 #3
0
 public async Task UpdateAsync(Person person)
 {
     _context.Entry(person).State = EntityState.Modified;
     _context.Set <Person>().Update(person);
     await _context.SaveChangesAsync();
 }