public taskstatusinfo Get(string requestId, string taskId)
        {
            var signHandler    = new SignRequestHandler();
            var taskstatusinfo = signHandler.getStatus(requestId);
            var result         = taskstatusinfo.Where(item => item.taskid == taskId).SingleOrDefault();

            return(result);
        }
        public async Task <List <string> > Post()
        {
            var signHereUrlList = new List <string>();

            if (HttpContext.Current.Request.Files.AllKeys.Any())
            {
                var postedFiles = new List <HttpPostedFile>();
                // Get the uploaded image from the Files collection
                for (int i = 0; i < HttpContext.Current.Request.Files.Count; i++)
                {
                    postedFiles.Add(HttpContext.Current.Request.Files["file" + i]);
                }

                // Get the uploaded recipients
                var recipients             = new List <ContactInfo>();
                var postedRecipientEmails  = HttpContext.Current.Request.Params["RecipientEmails"];
                var postedRecipientMobiles = HttpContext.Current.Request.Params["RecipientMobiles"];
                //var postedRecipientSSN = HttpContext.Current.Request.Params["RecipientSSN"];

                if (postedRecipientEmails != null)
                {
                    var recipientEmailList  = postedRecipientEmails.Split(',');
                    var recipientMobileList = postedRecipientMobiles.Split(',');
                    //var recipientSSNList = postedRecipientSSN.Split(',');

                    for (int i = 0; i < recipientEmailList.Length; i++)
                    {
                        if (recipientEmailList[i] == "null")
                        {
                            continue;
                        }

                        var contactInfo = new ContactInfo();
                        contactInfo.email  = recipientEmailList[i];
                        contactInfo.mobile = recipientMobileList[i];
                        //contactInfo.ssn = recipientSSNList[i];
                        recipients.Add(contactInfo);
                    }
                }

                var signingInfo = Helpers.GetSignInfo(HttpContext.Current.Request);

                if (postedFiles.Count > 0)
                {
                    var           signHandler       = new SignRequestHandler();
                    sdsdocument[] uploadedDocuments = await signHandler.UploadDocument(postedFiles);

                    if (uploadedDocuments == null)
                    {
                        return(null);
                    }

                    signingInfo.signingMetodText = new SignatureHandler().GetMethod(signingInfo.signMethod);
                    //signingInfo.isInk = new SignatureHandler().CheckIfInk(signingInfo.signMethod);

                    createrequestrequest request = signHandler.GetCreateRequest(uploadedDocuments, recipients,
                                                                                signingInfo);

                    new SignatureHandler().AddAuthMethod(signingInfo, request);

                    try
                    {
                        createrequestresponse response;
                        using (var client = new DocumentEndPointClient())
                        {
                            response = client.createRequest(request);
                        }

                        for (int i = 0; i < request.request[0].task.Length; i++)
                        {
                            var url = String.Format(
                                "https://preprod.signicat.com/std/docaction/prosesspilotene?request_id={0}&task_id={1}",
                                response.requestid[0], request.request[0].task[i].id);
                            signHereUrlList.Add(url);

                            var phonenr = request.request[0].task[i].subject.mobile;
                            if (signingInfo.SendSMS && !string.IsNullOrWhiteSpace(phonenr))
                            {
                                new NotificationHandler().AddSmsNotification(response, request, signingInfo, i, url, phonenr);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }

            return(signHereUrlList);
        }