public CreditsHero.Subscribers.Dtos.SubscribersRequestDetailsDto GetMemberRequestDetails(GetSubscribersRequestDetailInput input)
 {
     CreditsHero.Subscribers.Dtos.SubscribersRequestDetailsDto results = new CreditsHero.Subscribers.Dtos.SubscribersRequestDetailsDto();
     return (CreditsHero.Subscribers.Dtos.SubscribersRequestDetailsDto)_creditsHeroConnect.CallCreditsHeroService<SubscribersRequestDetailsDto>(results, input,
         "api/services/app/Subscriber/GetSubscribersRequestDetails");
 }
        public async Task<ActionResult> Quote(string requestId)
        {
            requestId = requestId == null ? Request.Form["PassRequestId"] : requestId;
            Models.Member.MemberRequestDetailViewModel results = new Models.Member.MemberRequestDetailViewModel();
            //Get the subscribers email to pass into CreditsHero in order to retreive summary
            var user = await _userManager.GetUserByIdAsync(AbpSession.UserId.Value);

            CreditsHero.Subscribers.Dtos.GetSubscribersInput input = new CreditsHero.Subscribers.Dtos.GetSubscribersInput()
            {
                SubscribersId = Int32.Parse(user.Id.ToString()),
                CompanyId = Guid.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["creditsHero:APIKey"]),
                SubscribersEmail = user.EmailAddress,
                SubscribersName = user.UserName
            };

            CreditsHero.Subscribers.Dtos.GetSubscribersRequestDetailInput inputRequest = new CreditsHero.Subscribers.Dtos.GetSubscribersRequestDetailInput()
            {
                SubscribersId = Int32.Parse(user.Id.ToString()),
                CompanyId = Guid.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["creditsHero:APIKey"]),
                SubscribersEmail = user.EmailAddress,
                SubscribersName = user.UserName,
                RequestId = requestId != null ? Int32.Parse(requestId) : 0
            };

            var creditsHeroSubscriber = _memberAppService.GetMember(input);
            input.SubscribersId = creditsHeroSubscriber.Id;
            inputRequest.SubscribersId = creditsHeroSubscriber.Id;

            //Get Members credits
            var creditsHeroSubscriberCredits = _memberAppService.GetMemberCredits(input);
            ViewBag.MemberCreditsRemaining = Math.Round(creditsHeroSubscriberCredits.TotalCredits);

            if (Request.Form.Keys[0] != null && Request.Form.Keys[0] == "PassRequestId")
            {
                _memberAppService.UpdateSubscriberRequestState(
                    new CreateSubscriberRequestStateInput()
                    {
                        CompanyId = Guid.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["creditsHero:APIKey"]),
                        RequestId = Int32.Parse(requestId),
                        SubscribersId = input.SubscribersId,
                        Status = "Pass"
                    });
                return Redirect(Url.Action("Index", "Home"));
            }
            else
            {
                List<SubscribersRequestDetailDto> subscriberRequestDetails = _memberAppService.GetMemberRequestDetails(inputRequest).SubscriberRequestDetailsList;
                results.SubscriberRequestDetails = new List<SubscribersRequestDetailDto>();

                results.SubscriberRequestDetails = subscriberRequestDetails;
                results.RequestId = Int32.Parse(requestId);
                results.SubscriberId = creditsHeroSubscriber.Id;
                return View(results);
            }
        }