Ejemplo n.º 1
0
        public async static Task <List <Attendance> > GetAttendanceResponse(int empid, DateTime SDate, DateTime EDate)
        {
            try
            {
                var url = Attendance.GenerateAttendanceURL(empid, SDate, EDate);
                using (HttpClient client = new HttpClient())
                {
                    var response = await client.GetAsync(url);

                    var json = await response.Content.ReadAsStringAsync();

                    var AttendanceList = JsonConvert.DeserializeObject <List <Attendance> >(json);
                    return(AttendanceList);
                }
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Attendance not loaded", "Internet is not available or Server not found", "OK");

                return(null);
            }
        }