Example #1
0
        public async static Task <List <Leave> > GetLeaveResponse(int empid)
        {
            try
            {
                List <Leave> LeaveList = new List <Leave>();
                var          url       = Leave.GenerateLeaveURL(empid);
                using (HttpClient client = new HttpClient())
                {
                    var response = await client.GetAsync(url);

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

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

                return(null);
            }
        }