public IActionResult Post([FromBody] PBSubscriptionsViewModel viewModel)
        {
            try
            {
                if (viewModel == null)
                {
                    return(BadRequest());
                }

                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                PBSubscriptions item = Mapper.Map <PBSubscriptions>(viewModel);
                item.CreatedDate     = DateTime.Now;
                item.LastUpdatedDate = DateTime.Now;
                item.IsActive        = true;

                _pbSubscriptionsRepository.Add(item);
                int save = _pbSubscriptionsRepository.Save();

                if (save > 0)
                {
                    return(CreatedAtRoute("GetById", new { controller = "PBSubscriptions", id = item.Id }, item));
                }

                return(BadRequest());
            }
            catch (Exception exception)
            {
                //Do something with the exception
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }
        private void SaveSubscriptionData(string content, string address)
        {
            string numbers = content.Substring(7).Trim(); // get the numbers
            string MSISDN = address.Split(':').LastOrDefault();

            PBSubscriptions pbSubscriptions = new PBSubscriptions()
            {
                MSISDN = MSISDN,
                PBNo = numbers,
                CreatedBy = MSISDN,
                LastUpdatedBy = MSISDN,
                PrizeDate = DateTime.Now,
                SubStartedDate=DateTime.Now,
                CreatedDate = DateTime.Now,
                LastUpdatedDate = DateTime.Now,
                IsActive = true
            };
            PBSubscriptionsRepository.Add(pbSubscriptions);
            PBSubscriptionsRepository.Save();
        }