Example #1
0
        public async Task <ActionResult <HomeLoanClass> > GetTodoItem(string appid, string email)
        {
            // string storageConnectionString = AppSettings.LoadAppSettings().StorageConnectionString;
            string storageConnectionString = _envvars.STORAGE_ENDPOINT;
            string homeloantablenameString = _envvars.STORAGE_TABLE_NAME;

            // string homeloantablenameString = AppSettings.LoadAppSettings().HomeLoanTableName;
            StorageHelpers.HomeLoanApplicationTableEntity loanapplication = new StorageHelpers.HomeLoanApplicationTableEntity();
            // Retrieve storage account information from connection string.
            CloudStorageAccount storageAccount = StorageHelpers.CreateStorageAccountFromConnectionString(storageConnectionString);

            // Create a table client for interacting with the table service
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient(new TableClientConfiguration());

            // Console.WriteLine("Create a Table for the demo");

            // Create a table client for interacting with the table service
            CloudTable table = tableClient.GetTableReference(homeloantablenameString);

            loanapplication = await StorageHelpers.RetrieveEntityUsingPointQueryAsync(table, email, appid);

            HomeLoanClass applicationdetails = new HomeLoanClass();

            if (loanapplication != null)
            {
                applicationdetails = JsonConvert.DeserializeObject <HomeLoanClass>(loanapplication.JsonBody);
                return(Ok(applicationdetails));
            }
            else
            {
                return(Ok());
            }
        }
Example #2
0
        public async Task <LoanSubmittedinfo> CreateAsync(HomeLoanClass loan)
        {
            //if (product.Description.Contains("XYZ Widget"))
            //{
            //    return BadRequest();
            //}

            //await _repository.AddProductAsync(product);

            LoanSubmittedinfo info = new LoanSubmittedinfo();
            //Insert the details to Azure Storate Table
            Guid g = Guid.NewGuid();

            StorageHelpers.HomeLoanApplicationTableEntity loanapplication = new StorageHelpers.HomeLoanApplicationTableEntity()
            {
                PartitionKey = loan.email,
                JsonBody     = JsonConvert.SerializeObject(loan),
                Timestamp    = DateTime.UtcNow,
                RowKey       = g.ToString()
            };

            string storageConnectionString = _envvars.STORAGE_ENDPOINT;
            string homeloantablenameString = _envvars.STORAGE_TABLE_NAME;
            //string storageConnectionString = AppSettings.LoadAppSettings().StorageConnectionString;
            //string homeloantablenameString = AppSettings.LoadAppSettings().HomeLoanTableName;
            // Retrieve storage account information from connection string.
            CloudStorageAccount storageAccount = StorageHelpers.CreateStorageAccountFromConnectionString(storageConnectionString);

            // Create a table client for interacting with the table service
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient(new TableClientConfiguration());

            // Console.WriteLine("Create a Table for the demo");

            // Create a table client for interacting with the table service
            CloudTable table = tableClient.GetTableReference(homeloantablenameString);

            //CloudTable table = new CloudTable()
            await StorageHelpers.InsertOrMergeEntityAsync(table, loanapplication);

            //Later On encrypt before storing

            info.assignedloanofficer = "test";
            info.datesubmitted       = DateTime.Now;
            info.appid = g.ToString();
            return(info);
        }