Exemple #1
0
        private async Task <List <FullStudent> > GetAllFullStudents()
        {
            //CosmosConnector dbConnector = new CosmosConnector("https://localhost:8081", "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==");

            var             url         = UtilityFunctions.UtilityFunctions.GetValueOfSetting("cosmosUrl");
            var             accessKey   = UtilityFunctions.UtilityFunctions.GetValueOfSetting("cosmosAccessKey");
            CosmosConnector dbConnector = new CosmosConnector(url, accessKey);

            dbConnector.PreviousDatabaseName = "StudentDatabase";
            dbConnector.PreviousTableName    = "StudentRecords";
            var records = await dbConnector.GetStudentRecords();

            List <FullStudent> fullStudents = new List <FullStudent>();

            foreach (var record in records)
            {
                var dict = (IDictionary <string, object>)record;

                FullStudent fullStudent = StudentMapper.DictionaryObjectToFullStudent(dict);

                //FullStudent fullStudent = new FullStudent()
                //{
                //    FirstName = dict["FirstName"] as string,
                //    MiddleName = dict["MiddleName"] as string,
                //    LastName = dict["LastName"] as string,
                //    DateOfBirth = (DateTime)dict["DateOfBirth"],
                //    Organization = dict["Organization"] as string,
                //    SchoolDivision = dict["SchoolDivision"] as string,
                //    Degree = dict["Degree"] as string,
                //    Awarded = (DateTime)dict["Awarded"],
                //    Major = dict["Major"] as string,
                //    PreviousRecordHash = dict["PreviousRecordHash"] as string,
                //    CurrentNodeHash = dict["CurrentNodeHash"] as string,
                //    Salt = dict["Salt"] as string,
                //    RecordId = Convert.ToInt32(dict["RecordId"])
                //};

                fullStudents.Add(fullStudent);
            }

            return(fullStudents);
        }
Exemple #2
0
        private async Task <List <FullStudent> > GetAllFullStudents()
        {
            var url       = UtilityFunctions.UtilityFunctions.GetValueOfSetting("cosmosUrl");
            var accessKey = UtilityFunctions.UtilityFunctions.GetValueOfSetting("cosmosAccessKey");
            IDatabaseConnector dbConnector = new CosmosConnector(url, accessKey);

            dbConnector.PreviousDatabaseName = "StudentDatabase";
            dbConnector.PreviousTableName    = "StudentRecords";
            var records = await dbConnector.GetStudentRecords();

            List <FullStudent> fullStudents = new List <FullStudent>();

            foreach (var record in records)
            {
                var dict = (IDictionary <string, object>)record;

                FullStudent fullStudent = StudentMapper.DictionaryObjectToFullStudent(dict);

                fullStudents.Add(fullStudent);
            }

            return(fullStudents);
        }