public async Task <IActionResult> PutOrganizationalUnit([FromRoute] Guid id, [FromBody] OrganizationalUnit organizationalUnit)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != organizationalUnit.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PutPhysicalPerson([FromRoute] Guid id, [FromBody] PhysicalPerson physicalPerson)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != physicalPerson.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }