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); }
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); }
public ActionResult Post([FromBody] CardDTO card) { try { var result = card_repo_.CreateCard(card); return(this.Ok(result)); } catch (Exception ex) { throw ex; } }
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); }
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); }
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); }