public async Task <IActionResult> Contact(Models.ContactUsModel model)
        {
            var authClient = await _repository.GetAuthorizedVantagePointClientAsync();

            //set up the query string to post contacts:
            string requestUri = $"contact";

            //this only works because the model and the contact class in VantagePoint
            //share the same names!
            var result = await _repository.PostAsync(authClient, requestUri, model);

            return(RedirectToAction("ThankYou", model));
        }
        public async Task <ActionResult> Index(Models.InvoiceViewModel model)
        {
            var authClient = await _repository.GetAuthorizedVantagePointClientAsync();

            string requestUri = $"utilities/invokecustom/getinvoiceinfo";
            Dictionary <string, object> spParams = new Dictionary <string, object>();

            spParams.Add("Invoice", model.RequestInvoice);

            //returns a structure in xml
            string invoiceInfo = await _repository.PostAsync <string>(authClient, requestUri, spParams);

            //turn structure into json
            var retvalJson = Helpers.XMLHelpers.StoredProcXMLToJObject(invoiceInfo);

            //turn structure into dicts
            var retvalDict = Helpers.XMLHelpers.StoredProcXMLToDictionary(invoiceInfo);

            //populating the model the hard way
            //with this code you have to know exactly what the stored procedure returns...
            model.Invoice     = retvalDict["Table"][0]["Invoice"].ToString();
            model.MainWBS1    = retvalDict["Table"][0]["MainWBS1"].ToString();
            model.InvoiceDate = DateTime.Parse(retvalDict["Table"][0]["InvoiceDate"].ToString());
            model.MainName    = retvalDict["Table"][0]["MainName"].ToString();
            model.Description = retvalDict["Table"][0]["Description"].ToString();
            model.ProjectName = retvalDict["Table"][0]["ProjectName"].ToString();
            model.ClientName  = retvalDict["Table"][0]["ClientName"].ToString();

            foreach (var item in retvalDict["Table1"])
            {
                Models.InvoiceSectionViewModel section = new Models.InvoiceSectionViewModel();
                section.Section     = item["section"].ToString();
                section.BaseAmount  = Decimal.Parse(item["BaseAmount"].ToString());
                section.FinalAmount = Decimal.Parse(item["FinalAmount"].ToString());
                model.Sections.Add(section);
            }

            model.TotalInvoiceAmount = model.Sections.Sum(x => x.FinalAmount);

            return(View(model));
        }