public VirtualCardDTO GetVirtualCardByCardNumber(string username, string cardnumber) { var account = accountService.GetAccountForUser(username); if (account == null) { return(null); } var vc = virtualCardRepository.GetByAccountIdAndCardNumber(account.Id, cardnumber); if (vc == null) { return(null); } return(VirtualCardConverter.ToDTO(vc)); }
private static ICollection <VirtualCardDTO> toVirtualCardsDTO(ICollection <VirtualCard> entities) { ICollection <VirtualCardDTO> cards = new List <VirtualCardDTO>(); if (entities == null) { return(cards); } foreach (VirtualCard en in entities) { cards.Add(VirtualCardConverter.ToDTO(en)); } return(cards); }
public IHttpActionResult GetAllVirtualCards(string username, string cardname) { return(Json(VirtualCardConverter.ToDTO(_service.GetVirtualCard(username, cardname)))); }