Пример #1
0
        public async Task <IActionResult> PutPersonContact(int id, int personId, PersonContact personContact)
        {
            if (id != personContact.PersonContactId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PutGreeting(int id, Greeting greeting)
        {
            if (id != greeting.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }