Exemplo n.º 1
0
        public async Task <IActionResult> PutPerson(string id, Person person)
        {
            if (id != person.FirstName)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Update(String id, Person person)
        {
            if (id != person.FirstName)
            {
                return(BadRequest());
            }

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

            return(NoContent());
        }