internal static bool PutStudentAggregate(dm.StudentAggregate studentAggregate)
        {
            SertifiHttpClient client = SertifiHttpClient.GetMyHttpClient();
            var response             = client.PutAsJsonAsync("/api/StudentAggregate", studentAggregate).Result;

            if (!response.IsSuccessStatusCode)
            {
                //Log this if we have a failure
                var log = response.StatusCode + " " + response.Content;
                return(false);
            }

            return(true);
        }
Example #2
0
        public ActionResult PutStudentAggregate()
        {
            _students = StudentRepository.GetStudents().Result;

            dm.StudentAggregate studentAggregate = new dm.StudentAggregate
            {
                YourName  = "Kevin Macek",          //Obviously we would never hard code this in real life
                YourEmail = "*****@*****.**", //Obviously we would never hard code this in real life
                YearWithHighestAttendance     = FindYearWithHighestAttendance(),
                YearWithHighestOverallGpa     = FindYearWithHighestOverallGpa(),
                Top10StudentIdsWithHighestGpa = FindTop10StudentIdsWithHighestGpa(),
                StudentIdMostInconsistent     = FindStudentIdMostInconsistent()
            };

            //Do this since we may want to make the user aware it failed on the frontend
            if (!StudentRepository.PutStudentAggregate(studentAggregate))
            {
                return(BadRequest());
            }

            return(Ok());
        }