コード例 #1
0
        public void CreateCard(Card card)
        {
            if (card.Assignees == null)
            {
                card.Assignees = new List <Member>();
            }
            if (card.Labels == null)
            {
                card.Labels = new List <Label>();
            }
            if (card.Attachments == null)
            {
                card.Attachments = new List <Attachment>();
            }
            if (card.Comments == null)
            {
                card.Comments = new List <Comment>();
            }
            if (card.CardInvites == null)
            {
                card.CardInvites = new List <Invitee>();
            }

            cardRepository.CreateCard(card);
        }
コード例 #2
0
        public void CreateCardTest()
        {
            // Create a card
            var card = _cardRepository.CreateCard("34567890", 100m, "1234");

            // Check balance
            Assert.Equal(100m, card.Balance);

            // Chec account number.
            Assert.Equal("34567890", card.AccountNumber);
        }
コード例 #3
0
ファイル: CardController.cs プロジェクト: igorsimovic/Tasker
        public ActionResult Post([FromBody] CardDTO card)
        {
            try
            {
                var result = card_repo_.CreateCard(card);

                return(this.Ok(result));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        public void WithdrawOnTwoCardsTest()
        {
            // Create a card
            var card1 = _cardRepository.CreateCard("34567890", 1000m, "1234");
            var card2 = _cardRepository.GetCard("34567890");

            Assert.True(Object.ReferenceEquals(card1, card2));

            // Check card 1 starting balance
            Assert.Equal(1000m, card1.Balance);

            // Check card 2 starting balance
            Assert.Equal(1000m, card2.Balance);

            // Make a withdrawl on card 1.
            card1.Withdraw("1234", 100m);

            // Check ending balance on card 1.
            Assert.Equal(900m, card1.Balance);

            // Check ending balance on card 2.
            Assert.Equal(900m, card2.Balance);
        }
コード例 #5
0
        public void WithdrawTest()
        {
            // Create a card
            var card = _cardRepository.CreateCard("34567890", 1000m, "1234");

            // Check the starting balance
            Assert.Equal(1000m, card.Balance);

            // Make a withdrawl
            card.Withdraw("1234", 23.33m);

            // Check ending balance.
            Assert.Equal(976.67m, card.Balance);
        }
コード例 #6
0
ファイル: CardService.cs プロジェクト: mwalczynski/PGSKanban
        public CardDto CreateCard(AddCardDto cardDto, string userId)
        {
            if (!_listRepository.IsOwner(cardDto.ListId, userId))
            {
                return(null);
            }

            var card     = _mapper.Map <Card>(cardDto);
            var position = _cardRepository.GetNumberOfCardsInList(cardDto.ListId) + 1;

            card.Position = position;
            var addedCard = _cardRepository.CreateCard(card);
            var result    = _mapper.Map <CardDto>(addedCard);

            result.ObfuscatedId = _obfuscator.Obfuscate(result.Id);
            return(result);
        }