Exemplo n.º 1
0
        public async Task <long> CreateCart(CreateCartDto createCartDto)
        {
            var count = await _cartsRepository.GetCountCartsInList(createCartDto.ListId);

            var cart = new Cart()
            {
                Name        = createCartDto.Name,
                Description = createCartDto.Description,
                ListId      = createCartDto.ListId,
                Position    = count
            };

            _cartsRepository.Insert(cart);
            await _cartsRepository.SaveChangesOnContext();

            var list = await _listsRepository.GetEntity(createCartDto.ListId);

            return(list.BoardId);
        }
Exemplo n.º 2
0
        public async Task <bool> RemoveList(long listId)
        {
            var list = await _listsRepository.GetEntity(listId);

            if (list == null)
            {
                return(false);
            }
            var board = await _boardsRepository.GetEntity(list.BoardId);

            var currentUserId = _authInfrastructure.GetCurrentUserId();

            if (currentUserId != board.OwnerId)
            {
                return(false);
            }

            _listsRepository.Remove(list);
            await _listsRepository.SaveChangesOnContext();

            return(true);
        }