コード例 #1
0
        //TODO Should implement Interface contract so we can test consistently
        public static async Task <List <dm.Student> > GetStudents()
        {
            SertifiHttpClient   client   = SertifiHttpClient.GetMyHttpClient();
            List <dto.Student>  students = new List <dto.Student>();
            HttpResponseMessage response = await client.GetAsync("/api/Students");

            if (response.IsSuccessStatusCode)
            {
                students = response.Content.ReadAsAsync <List <dto.Student> >().Result;
            }

            return(Mapper.Map <List <dm.Student> >(students));
        }
コード例 #2
0
        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);
        }