Exemplo n.º 1
0
        public async Task <ListWithShares> GetWithSharesAsync(int id, int userId)
        {
            ToDoList list = await _listsRepository.GetWithOwnerAsync(id, userId);

            if (list == null)
            {
                return(null);
            }

            list.Shares.AddRange(await _listsRepository.GetSharesAsync(id));

            var result = _mapper.Map <ListWithShares>(list, opts => { opts.Items["UserId"] = userId; });

            result.Shares.RemoveAll(x => x.UserId == userId);

            return(result);
        }