Example #1
0
        public void Post([FromBody] CardDTO cardDto)
        {
            Card card = new Card()
            {
                CardBrand      = cardDto.CardBrand,
                CardholderName = cardDto.CardholderName,
                CVS            = cardDto.CVS,
                CardType       = cardDto.CardType,
                Id             = cardDto.CardId,
                ExpirationDate = cardDto.ExpirationDate,
                Number         = cardDto.Number,
                CreatedDate    = cardDto.CreatedDate
            };

            try
            {
                _CardBusiness.SaveAndUpdate(card);
                _CardBusiness.Save();
            }
            catch (Exception ex)
            {
                TelemetryService.TraceException(ex, JsonConvert.SerializeObject(cardDto));

                throw new System.Web.Http.HttpResponseException(System.Net.HttpStatusCode.InternalServerError);
            }
        }