예제 #1
0
        public async Task AddCardToCardListAsync(CardList cardList, Card card)
        {
            var foundCardList = await FindAndCheckNullabilityHelper <CardList> .InDatabaseAsync(context.CardLists, cardList, "Card list not found!", false);

            var foundCard = await FindAndCheckNullabilityHelper <Card> .InCollectionAsync(foundCardList.Cards, card, "Card is already in this card list!", true);

            foundCardList.Cards.Add(card);
        }
예제 #2
0
        public async Task RemoveCardFromCardListAsync(CardList cardList, Card card)
        {
            var foundCardList = await FindAndCheckNullabilityHelper <CardList> .InDatabaseAsync(context.CardLists, cardList, "Card list not found!", false);

            var foundCard = await FindAndCheckNullabilityHelper <Card> .InCollectionAsync(foundCardList.Cards, card, "Card not found!", false);

            foundCardList.Cards.Remove(foundCard);
        }
예제 #3
0
        public async Task RemoveCommentFromCardAsync(Card card, Comment comment)
        {
            try
            {
                var foundCard = await FindAndCheckNullabilityHelper <Card> .InDatabaseAsync(context.Cards, card, "Card not found!", false);

                var foundComment = await FindAndCheckNullabilityHelper <Comment> .InCollectionAsync(foundCard.Comments, comment, "Comment was not found!", false);

                foundCard.Comments.Remove(foundComment);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public async Task RemoveCardListFromBoardAsync(Board board, CardList cardList)
        {
            try
            {
                var foundBoard = await FindAndCheckNullabilityHelper <Board> .InDatabaseAsync(context.Boards, board, "Board was not found!", false);

                var foundCardList = await FindAndCheckNullabilityHelper <CardList> .InCollectionAsync(foundBoard.CardLists, cardList, "Card list not found!", false);

                foundBoard.CardLists.Remove(foundCardList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #5
0
        public async Task RemoveLabelColorFromCardAsync(Card card, LabelColor labelColor)
        {
            try
            {
                var foundCard = await FindAndCheckNullabilityHelper <Card> .InDatabaseAsync(context.Cards, card, "Card not found!", false);

                var foundLabeColor = await FindAndCheckNullabilityHelper <LabelColor> .InCollectionAsync(foundCard.LabelColors, labelColor, "Label color was not found!", false);

                foundCard.LabelColors.Remove(foundLabeColor);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #6
0
        public async Task RemoveUserFromCardAsync(Card card, User user)
        {
            try
            {
                var foundCard = await FindAndCheckNullabilityHelper <Card> .InDatabaseAsync(context.Cards, card, "Card not found!", false);

                var foundUser = await FindAndCheckNullabilityHelper <User> .InCollectionAsync(foundCard.Users, user, "User was not found!", false);

                foundCard.Users.Remove(foundUser);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
        public async Task AddUserToCardAsync(Card card, User user)
        {
            try
            {
                var foundCard = await FindAndCheckNullabilityHelper <Card> .InDatabaseAsync(context.Cards, card, "Card not found!", false);

                var foundUser = await FindAndCheckNullabilityHelper <User> .InCollectionAsync(foundCard.Users, user, "User is already assigned to this card!", true);

                foundCard.Users.Add(user);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #8
0
        public async Task AddLabelColorToCardAsync(Card card, LabelColor labelColor)
        {
            try
            {
                var foundCard = await FindAndCheckNullabilityHelper <Card> .InDatabaseAsync(context.Cards, card, "Card not found!", false);

                var foundLabeColor = await FindAndCheckNullabilityHelper <LabelColor> .InCollectionAsync(foundCard.LabelColors, labelColor, "Such label color is already assigned to this card!", true);

                labelColor.Cards.Add(foundCard);
                context.Set <LabelColor>().Add(labelColor);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #9
0
        public async Task AddCardListToBoardAsync(Board board, CardList cardList)
        {
            try
            {
                var foundBoard = await FindAndCheckNullabilityHelper <Board> .InDatabaseAsync(context.Boards, board, "Board was not found!", false);

                var foundCardList = await FindAndCheckNullabilityHelper <CardList> .InCollectionAsync(foundBoard.CardLists, cardList, "Card list is already in this board!", true);

                cardList.Board = foundBoard;
                context.Set <CardList>().Add(cardList);
                //foundBoard.CardLists.Add(cardList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #10
0
        public async Task RemoveUserFromBoardAsync(Board board, User user)
        {
            try
            {
                var foundBoard = await FindAndCheckNullabilityHelper <Board> .InDatabaseAsync(context.Boards, board, "Board was not found!", false);

                var foundUser = await FindAndCheckNullabilityHelper <User> .InDatabaseAsync(context.Users, user, "User does not exist in database!", false);

                foundUser = await FindAndCheckNullabilityHelper <User> .InCollectionAsync(foundBoard.Users, user, "User is not assigned to this board!", false);

                foundBoard.Users.Remove(foundUser);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #11
0
        public async Task AddCommentToCardAsync(Card card, Comment comment)
        {
            try
            {
                var foundCard = await FindAndCheckNullabilityHelper <Card> .InDatabaseAsync(context.Cards, card, "Card not found!", false);

                var foundComment = await FindAndCheckNullabilityHelper <Comment> .InCollectionAsync(foundCard.Comments, comment, "Comment is already assigned to a card!", true);

                comment.Card = foundCard;
                context.Set <Comment>().Add(comment);
                //foundCard.Comments.Add(comment);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }