コード例 #1
0
        public async Task <IActionResult> PutLock([FromRoute] Guid id, [FromBody] Lock @lock)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != @lock.LockId)
            {
                return(BadRequest());
            }

            _context.Entry(@lock).State = EntityState.Modified;

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PutUserGroupMember([FromRoute] Guid id, [FromBody] UserGroupMember userGroupMember)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userGroupMember.UserGroupMemberId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }