Example #1
0
        /// <summary>
        /// Converts a BitwardenItemDTO to an IdentityItem
        /// </summary>
        /// <param name="dto">The BitwardenItemDTO that should be convertet</param>
        /// <returns>The convertet IdentityItem</returns>
        private static IdentityItem ConvertIdentityItem(BitwardenItemDTO dto)
        {
            var identityItem = new IdentityItem();

            identityItem          = (IdentityItem)ConvertBasic(identityItem, dto);
            identityItem.Identity = dto.Identity.ConvertBack();
            return(identityItem);
        }
        public async Task <ActionResult <IdentityItemDto> > CreateIdentityAsync(CreateIdentityItemDto createdItemDto)
        {
            IdentityItem item = _mapper.Map <IdentityItem>(createdItemDto);

            await _repository.CreateItemAsync(item);

            string actionName = nameof(GetItemAsync);

            return(CreatedAtAction(actionName, new { id = item.Id }, _mapper.Map <IdentityItemDto>(item)));
        }
Example #3
0
        internal void Expand(byte[] sourceArray)
        {
            ItemCount = BitConverter.ToUInt16(sourceArray, 0);

            int offset = 1;

            if (ItemCount > 0)
            {
                IdentityItems = new IdentityItem[ItemCount];
            }
            else
            {
                return;
            }

            for (int i = 0; i < ItemCount; i++)
            {
                offset += 1;
                IdentityItem ii = new IdentityItem();
                ii.Expand(sourceArray, offset, out offset);
                IdentityItems[i] = ii;
            }
        }
Example #4
0
 public async Task UpdateItemAsync(IdentityItem updatedItem)
 {
     var filter = _filterDefinitionBuilder.Eq(existingItem => existingItem.Id, updatedItem.Id);
     await _identityItemsCollection.ReplaceOneAsync(filter, updatedItem);
 }
Example #5
0
 public async Task CreateItemAsync(IdentityItem item)
 {
     await _identityItemsCollection.InsertOneAsync(item);
 }