public Card ConvertToCard(CardModel card, CardImage image)
        {
            Card localCard = new Card
            {
                Address = card.Address,
                ImageId = image.Id,
                Id = card.Id,
                City = card.City,
                Company = card.Company,
                Country = card.Country,
                CreatedDate = card.CreatedDate,
                CreatedUserId = card.CreatedUserId,
                Email = card.Email,
                Fax = card.Fax,
                Firstname = card.Firstname,
                Homepage = card.Homepage,
                IsDeleted = card.IsDeleted,
                Lastname = card.Lastname,
                Other = card.Other,
                Phonenumber = card.Phonenumber,
                Postal = card.Postal,
                Title = card.Title

            };
            return localCard;
        }
 public void CreateCardImage(CardImage cardImage)
 {
     using (var db = new BusinessCardScannerEntities())
     {
         db.Configuration.ProxyCreationEnabled = false;
         db.CardImage.Add(cardImage);
         db.SaveChanges();
     }
 }
        public HttpResponseMessage PostAndGetId(CardModel card)
        {
            if (card != null)
            {
                ReplaceNullWithEmpty(card);
                CardImage image = new CardImage();
                image.EncodedImage = !card.EncodedImage.IsNullOrWhiteSpace() ? card.EncodedImage : "TEMPDATA";
                _facade.GetCardRepo().CreateCardImage(image);
                Card localCard = _classConverter.ConvertToCard(card, image);

                _facade.GetCardRepo().Add(localCard);
                return Request.CreateResponse(HttpStatusCode.OK, localCard.Id);
            }
            return null;
        }
        public void PostCard(CardModel card)
        {
            if (card != null)
            {
                ReplaceNullWithEmpty(card);
                CardImage image = new CardImage();
                image.EncodedImage = !card.EncodedImage.IsNullOrWhiteSpace() ? card.EncodedImage : "TEMPDATA";
                _facade.GetCardRepo().CreateCardImage(image);
                Card localCard = _classConverter.ConvertToCard(card, image);

                _facade.GetCardRepo().Add(localCard);
            }
        }