コード例 #1
0
        public async Task DeleteListItem(int listItemId)
        {
            var listItem = await _listItemService.GetAsync(listItemId);

            if (listItem == null)
            {
                throw new NotFoundException("List item does not exist, or You don't have permissions to view it."); // TODO: Message
            }
            var list = await _listService.GetAsync(listItem.ListId, UserIdentityId);

            if (list == null)
            {
                throw new NotFoundException("List does not exist, or You don't have permissions to view it."); // TODO: Message
            }
            listItem.IsDeleted = true;
            _dbcontext.Update(listItem);
            await _dbcontext.SaveChangesAsync();

            await Clients.Group($"List_{list.Id}").DeleteListItemAsync(listItemId);
        }