Exemplo n.º 1
0
        public async Task <Response <RequestPublish> > GetData(Context ctx, int pageNumber)
        {
            if (!IsConnectedToInternet(ctx))
            {
                return new Response <RequestPublish> {
                           IsSuccess = false, Message = ctx.GetString(Resource.String.msg_no_internet_conection)
                }
            }
            ;

            try {
                mediaService = RestService.For <ISocialMediaService>(ctx.GetString(Resource.String.resource_url_api));

                var result = await mediaService.GetPublish(pageNumber);

                return(new Response <RequestPublish> {
                    IsSuccess = true, Result = result
                });
            }
            catch (System.Exception ex) {
                return(new Response <RequestPublish> {
                    IsSuccess = false, Message = ex.Message
                });
            }
        }