public HelloRestViewController()
     : base("HelloRestViewController", null)
 {
     restFacilitator = new RestFacilitator();
     restService = new RestService(restFacilitator, baseUri);
     peeps = new List<string>();
 }
        private static void Main(string[] args)
        {
            var restService = new RestService("", "",
                "");
            // var restService = new RestService("http://jsonplaceholder.typicode.com");

            var gate = new GeoEntityJsonGateway(@"c:\tmp\layer.json");

            var geoserverClient = new GeoserverRestClient(restService);

            var testLayer = "{'featureType': {'name': 'new_test_layer','title': 'new_test_layer','srs': 'EPSG:4326','projectionPolicy': 'FORCE_DECLARED','enabled': 'true','metadata': {'entry': {'@key': 'JDBC_VIRTUAL_TABLE','virtualTable': {'name': 'new_test_layer','sql': 'SELECT uuid, cellid, cellname, cellname as sigga_external_id, cellstate, operator, latitude, longitude, azimuth, sectorid, siteenvironment, siteid, vendor, tech, band, sector, oss, mcc, mnc, controllerid, controllername, lac, rac, tac, carrier, frequency, code, dldataspeed,cellgeomsmall as geom,cellgeommicrotiny as microtiny, cellgeomtiny as tiny, cellgeomsmall as small, cellgeommedium as medium, cellgeombig as big, cellgeombigger as bigger,cellgeomhuge as huge, errors FROM view_livefulldata_cell','escapeSql': 'false'}}},'overridingServiceSRS': 'false','circularArcPresent': 'false'}}";
            var newtest = "{'featureType':{'name':'eventsmobilityreselectiontoeutranfail_ireland','title':'eventsmobilityreselectiontoeutranfail_ireland','srs':'EPSG: 4326','projectionPolicy':'FORCE_DECLARED','enabled':'true','metadata':{'entry':{'@key':'JDBC_VIRTUAL_TABLE','virtualTable':{'name':'eventsmobilityreselectiontoeutranfail_ireland','sql':'select * from eventsmobilityreselectiontoeutranfail_ireland where eventsuccessfull=false','escapeSql':'true'}}}}}";

            var response = restService.Post(new ServiceRequest("workspaces/webgis-dev/datastores/networkTopologyDev/featuretypes") { Body = newtest });

            //restService.Post(new ServiceRequest("workspaces/webgis-dev/datastores/networkTopologyDev/featuretypes") {Body = testLayer});
            //var response =
            //    restService.Get(
            //        new ServiceRequest("workspaces/webgis-dev/datastores/networkTopologyDev/featuretypes/new_test_layer"));
            //var layerInfo = JsonConvert.DeserializeObject<GeoEntity>(response.Data);

            // var response = restService.Get(new ServiceRequest("layers/uk_postcode"));
            //geoserverClient.GetAllWorkSpaces();

            var output = geoserverClient.GetLayerInfoBy("networkTopologyDev", "webgis-dev", "new_test_layer");

            Console.WriteLine(response.StatusCode.ToString());
            Console.WriteLine(response.Data);

            Console.ReadKey();
        }
Example #3
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var baseUri = "http://search.twitter.com/";

            var restFacilitator = new RestFacilitator();

            var restService = new RestService(restFacilitator, baseUri);

            var asyncDelegation = new AsyncDelegation(restService);

            //call http://search.twitter.com/search.json?q=#haiku
            asyncDelegation.Get<Hash>("search.json", new { q = "#haiku" })
                           .WhenFinished(
                           result =>
                           {
                               List<string> tweets = new List<string>();
                               textBlockTweets.Text = "";
                               foreach (var tweetObject in result["results"].ToHashes())
                               {
                                   textBlockTweets.Text += HttpUtility.HtmlDecode(tweetObject["text"].ToString()) + Environment.NewLine + Environment.NewLine;
                               }
                           });

            asyncDelegation.Go();
        }
Example #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var baseUri = "http://search.twitter.com/";

            var restFacilitator = new RestFacilitator();

            var restService = new RestService(restFacilitator, baseUri);

            var asyncDelegation = new AsyncDelegation(restService);

            asyncDelegation.Get<TwitterProxy.twitterresults>("search.json", new { q = "#haiku" })
                           .WhenFinished(
                           result =>
                           {
                               List<string> tweets = new List<string>();
                               textBlockTweets.Text = "";
                               tweets = result.results.Select(s => s.text).ToList();
                               foreach (string tweet in tweets)
                               {
                                   textBlockTweets.Text += HttpUtility.HtmlDecode(tweet) + Environment.NewLine + Environment.NewLine;
                               }
                           });

            asyncDelegation.Go();
        }
Example #5
0
        static void Main(string[] args)
        {
            RestService service=    new RestService();
            ServiceHost  host=new ServiceHost(service);
            host.Open();
              // CCTVInfo [] info=new CCTVInfo[]{
              //    new CCTVInfo(){ ch=1, MjpegUrl= "http://192.192.85.33/axis-cgi/mjpg/video.cgi?camera=1", UserName= "******", Password= "******", StreamServerPort= 9090},
              //    new CCTVInfo(){ ch=2, MjpegUrl= "http://192.192.85.33:204/axis-cgi/mjpg/video.cgi?camera=1", UserName= "******", Password= "******", StreamServerPort= 9091},
              //    new CCTVInfo(){ ch=3 ,MjpegUrl= "http://192.192.85.33/axis-cgi/mjpg/video.cgi?camera=1", UserName= "******", Password= "******", StreamServerPort= 9092},
              //    new CCTVInfo(){ ch=4, MjpegUrl= "http://192.192.85.33:204/axis-cgi/mjpg/video.cgi?camera=1", UserName= "******", Password= "******", StreamServerPort= 9093}

              //};

              //ETAGReader reader= new ETAGReader("192.192.85.33", 50007);
              //RiaObject obj = new RiaObject(info, reader, 1, 7);
               char c;
              //RiaObject.AddWhiteList("0X00BFDE232520FF63991F027B");
              //RiaObject.AddWhiteList("0X110514000000000000000386");
              while(true)
            {
                c = Console.ReadKey().KeyChar;
                switch (c)
                {
                    case '0':
                        RiaObject.DisableETagEffect();
                        break;
                    case '1':
                        RiaObject.EnableETagEffect();
                        break;
                }

            }
        }
        static void Main(string[] args)
        {
            // enable this if you need to break the command-line and attach debugger
            //Console.ReadLine();

            if (args.Length != 4)
            {
                System.Console.WriteLine("Usage: JIRA-ClearAllComponents <UserName> <Password> <JIRA_REST_BASE_URI> <PROJECT>");
                return;
            }
            else
            {
                try
                {
                    _UserName = args[0].ToString();
                    _Password = args[1].ToString();
                    _URI = args[2].ToString();
                    _Project = args[3].ToString();
                }
                catch
                {
                    System.Console.WriteLine("Check the Parameters");
                }
            }

            Action<JObject[]> doc = delegate (JObject[] d) { ProcessXML(d); };
            Action<Exception> err = delegate (Exception e) { DealWithError(e); };

            RestService r = new RestService();
            r.MakeJsonRequest<JObject[]>(_URI, doc, err);
        }
Example #7
0
		public async Task<bool> CheckLoginData(LoginModel loginData, string server)
		{
			try {
				RestService restService = new RestService ("/api/login", server);
				var request = await restService.Post (loginData.Username, loginData.Password);
				if (request.StatusCode ==System.Net.HttpStatusCode.NotFound){
					ErrorMessage =Localaizer.Localize("notFoundServer");
					return false;
				}
			} catch (AggregateException e) {
				if (e.InnerExceptions [0].GetType () ==  _platformException.URISyntaxException()) {
					ErrorMessage = Localaizer.Localize("uncorrectURI");
				} else {
					if (e.InnerExceptions [0].Data.Count > 0) {
						ErrorMessage =Localaizer.Localize(e.InnerExceptions [0].Data ["message"].ToString ());
					} else {
						ErrorMessage=Localaizer.Localize("undefinedException");
					}
				}
				//return false;
			}

			_loginModel = new LoginMockModel ();
			return _loginModel.Username == loginData.Username && _loginModel.Password == loginData.Password;
		}
Example #8
0
 private static AsyncDelegation NewAD(string baseUri)
 {
     RestFacilitator restFacilitator = new RestFacilitator();
     RestService restService = new RestService(restFacilitator, baseUri);
     AsyncDelegation asyncDelegation = new AsyncDelegation(restService);
     return asyncDelegation;
 }
Example #9
0
        public ActionResult SaveUploadedFile(EtkinlikModel etkinlik)
        {
            bool isSavedSuccessfully = true;
            string fName = "";
            var path = "";
            try
            {
                foreach (string fileName in Request.Files)
                {
                    HttpPostedFileBase file = Request.Files[fileName];
                    //Save file content goes here
                    fName = file.FileName;
                    if (file != null && file.ContentLength > 0)
                    {

                        var originalDirectory = new DirectoryInfo(string.Format("{0}Images\\Afis", Server.MapPath(@"\")));

                        string pathString = System.IO.Path.Combine(originalDirectory.ToString(), "imagepath");

                        var fileName1 = Path.GetFileName(file.FileName);

                        bool isExists = System.IO.Directory.Exists(pathString);

                        if (!isExists)
                            System.IO.Directory.CreateDirectory(pathString);

                        path = string.Format("{0}\\{1}", pathString, file.FileName);
                        file.SaveAs(path);

                    }

                }

            }
            catch (Exception ex)
            {
                isSavedSuccessfully = false;
            }


            if (isSavedSuccessfully)
            {
                RestService service = new RestService();
                RestRequest request = new RestRequest("api/Etkinliks", Method.POST);
                var token = Request.Headers["Authorization"];
                request.AddParameter("Adi", etkinlik.EtkinlikAdi);
                request.AddParameter("Tarihi", etkinlik.EtkinlikTarihi.ToShortDateString());
                request.AddParameter("AcilisTarihi", etkinlik.AcilisTarihi);
                request.AddParameter("KapanisTarihi", etkinlik.KapanisTarihi);
                request.AddParameter("Aciklama", etkinlik.Aciklama);
                request.AddParameter("FotoName", fName);

                var result = service.Execute<Object>(request,token);
                return Json(result, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new { Message = "Error in saving file" });
            }
        }
 public HomeViewController()
     : base("HomeViewController", null)
 {
     Title = NSBundle.MainBundle.LocalizedString ("Games", "Games");
     restFacilitator = new RestFacilitator();
     restService = new RestService(restFacilitator, baseUri);
 }
Example #11
0
 public JsonResult Control()
 {
     RestService service = new RestService();
     var sa = Request.Headers["Authorization"];
     var result = service.Get<Object>("admin/get", sa);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Example #12
0
 private RestClient(string uriFormat, RestService service, string operationGroup,
                    Dictionary<string, object> inheritedParameters)
     : this(uriFormat, service)
 {
     _operationGroup = operationGroup;
     _parameters = inheritedParameters;
 }
Example #13
0
 public JsonResult getCekilis()
 {
     RestService service = new RestService();
     var request = new RestRequest("api/Cekilis", Method.GET);
     var token = Request.Headers["Authorization"];
     var result = service.Execute<Object>(request, token);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
        public UserTaskService(RestService restService, IDbContext dbContext,ITokenProvider tokenProvider, IUserPreferenceService userPreferenceService)
        {
            _restService = restService;
            _dbContext = dbContext;

            var _authToken = tokenProvider.GetCurrentToken().Result;
            _currentLoggedInUser = userPreferenceService.GetUserByEmailId(_authToken.Email).Result;
        }
 public GameViewController(Guid gameId)
     : base("GameViewController", null)
 {
     Title = NSBundle.MainBundle.LocalizedString ("Name", "Name");
     restFacilitator = new RestFacilitator();
     restService = new RestService(restFacilitator, baseUri);
     _gameId = gameId;
 }
Example #16
0
        public static string GetSearchTerms(string q)
        {
            string autocompleteUrl = "services/rest/index/indexweb/autocompletion/autocomplete";
            string autocompleteUrlParams = "?prefix=" + HttpUtility.UrlEncode(q) + "&login=admin&key=54a51ee4f27cbbcb7a771352b980567f";

            AutocompleteResponse response = new RestService().GetRestService<AutocompleteResponse>(ServerUrl + autocompleteUrl, autocompleteUrlParams);
            return JsonConvert.SerializeObject(response);
        }
        private static void ProcessXML(JObject[] message)
        {
            RestService r = new RestService();

            foreach (JObject j in message)
            {
                r.MakeDeleteRequest(_URI, (string)j["id"]);
            }
        }
Example #18
0
 public JsonResult Etkinlik(int id)
 {
     RestService service = new RestService();
     var request = new RestRequest("api/Etkinliks",Method.GET);
     request.AddParameter("id", id);
     var token = Request.Headers["Authorization"];
     var result = service.Execute<Object>(request, token);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Example #19
0
        //[ValidateAntiForgeryToken]
        public JsonResult Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return Json(response.ModelError());
            }

            RestService service = new RestService();

            return Json(service.login(model.userName, model.Password));
        }
        /// <summary>
        /// Initializes a new instance of the RestRouteService class with
        /// the specified Routing service url, Routing layer name and ArcGIS
        /// server hosting routing service.
        /// </summary>
        /// <param name="serviceUrl">The Routing service url.</param>
        /// <param name="layerName">The name of the Routing layer.</param>
        /// <param name="server">ArcGIS server instance hosting routing service.</param>
        public RestRouteService(
            string serviceUrl,
            string layerName,
            AgsServer server)
        {
            Debug.Assert(server != null);

            _server = server;
            _baseUrl = UriHelper.Concat(serviceUrl, layerName);
            _baseUrl = UriHelper.Concat(_baseUrl, QUERY_OBJ_SOLVE);
            _restService = new RestService();
        }
Example #21
0
 public JsonResult KariyerSampiyonlariEkle(KariyerSampiyonlariKayit user)
 {
     RestService service = new RestService();
     var request = new RestRequest("api/KariyerSampiyonlariKayit", Method.POST);
     request.AddParameter("Email", user.Email);
     request.AddParameter("Name", user.Name);
     request.AddParameter("Surname", user.Surname);
     request.AddParameter("Phone", user.Phone);
     var token = Request.Headers["Authorization"];
     var result = service.Execute<Object>(request, token);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Example #22
0
 public JsonResult getEtkinlik()
 {
     RestService service = new RestService();
     var token = Request.Headers["Authorization"];
     var gecmis = service.Get<Object>("api/GecmisEtkinlik", token);
     var gelecek = service.Get<Object>("api/GelecekEtkinlik", token);
     var buHafta = service.Get<Object>("api/HaftaEtkinlik", token);
     return Json(new {
         gecmis,
         buHafta,
         gelecek
     }, JsonRequestBehavior.AllowGet);
 }
Example #23
0
		public async Task<List<VTSModel>> GetVTSList ()
		{
			ModelConverter converter = new ModelConverter ();
			List<VacationInfoModel> listVacationInfoModel;

			try {
				RestService restService = new RestService ("/api/Vacations", Server);
				listVacationInfoModel = await restService.Get<VacationInfoModel> ();
			} catch (AggregateException e) {
				//ErrorMessage = e.InnerExceptions [0].Data ["message"].ToString ();
				listVacationInfoModel = null;
			}

			SQLiteService sqliteService;
			try {
				sqliteService = new SQLiteService (_sqlitePlatform, await _fileSystem.GetPath ("VTS"));
			} catch {
				sqliteService = null;
			}

			List<VTSModel> VTSViewModelList = new List<VTSModel> ();
			VTSModel newItem;

			listVacationInfoModel = new VacationInfoMockModel ().Vacations;


			if (listVacationInfoModel != null) {
				foreach (VacationInfoModel info in listVacationInfoModel) {
					newItem = converter.ConvertToVTSModel (info);
					VTSViewModelList.Add (newItem);
					if (sqliteService != null) {
						await sqliteService.Insert<VacationInfoDTO> (converter.ConvertToVacationInfoDTO (newItem));
					}
				}
			} else if(sqliteService != null) {
				List<VacationInfoDTO> vacationInfoList = await sqliteService.Get<VacationInfoDTO> ();
				if (vacationInfoList != null) {
					foreach (VacationInfoDTO info in vacationInfoList) {
						VTSViewModelList.Add (converter.ConvertToVTSModel (info));
					}
				}
			}
		
			return VTSViewModelList;
		}
Example #24
0
		public void LoadLocalization (string language = null)
		{
			if (language == null) {
				language = _localizer.GetCurrentCultureInfo ();
			}

			try {
				RestService restService = new RestService ("/Resources/Strings-" + language + ".json", ConfigurationManager.SERVER);

				Task<LocalizeModel> task = Task.Run (async () => await restService.GetDataFromJsonFile<LocalizeModel> ());
				task.Wait ();

				Data = task.Result;
			} catch {
				//var a = e.InnerExceptions[0].Data["message"];
				Data = new LocalizeModel ();
			}
		}
Example #25
0
		public async void TestRestService()
		{ 
			RestService rest = new RestService ("/api/Vacations", _testServer);

			var vacationInfo = await rest.Get<VacationInfoModel> ("1");
			Assert.IsNotNull (vacationInfo, "Message: " + _testServer + "/api/vacations/get?id=1 return null");

			List<VacationInfoModel> vacationInfoList =await rest.Get<VacationInfoModel> ();
			Assert.IsNotNull (vacationInfoList, "Message: " + _testServer + "/api/vacations return null");

			var response = await rest.Post<VacationInfoModel> (new VacationInfoModel ());
			Assert.AreEqual (response.StatusCode, System.Net.HttpStatusCode.NoContent,"Message: " + _testServer + "/api/vacations/post return error");

			response = await rest.Post ("", "");
			Assert.AreEqual (response.StatusCode, System.Net.HttpStatusCode.NoContent,"Message: " + _testServer + "/api/vacations/post?name=*password=* return error");

			rest = new RestService("/Resources/Strings-"+_localizer.GetCurrentCultureInfo()+".json", _testServer);
			LocalizeModel localizeModel = await rest.GetDataFromJsonFile<LocalizeModel> ();
			Assert.IsNotNull (localizeModel, "Message: " + _testServer + "/api/vacations return null");
		}
        public bool canDo(RestService.Entities.Action action)
        {
            bool allowed = false;

            for (int i = 0; i < actions.Length; i++)
            {
                if (action.Equals(actions[i]))
                {
                    if (actions[i].allowed)
                    {
                        allowed = true;
                    }
                    else if (!actions[i].allowed)
                    {
                        return false;
                    }
                }
            }

            return allowed;
        }
Example #27
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            var baseUri = "http://search.twitter.com/";

            var restFacilitator = new RestFacilitator();

            var restService = new RestService(restFacilitator, baseUri);

            var asyncDelegation = new AsyncDelegation(restService);

            asyncDelegation.Get<Hash>("search.json", new { q = "#haiku" })
                           .WhenFinished(
                               result =>
                               {
                                   JsonVisualization jsonVisualization = new JsonVisualization();
                                   jsonVisualization.Parse("root", result, 0);
                                   textBlockTweets.Text = jsonVisualization.JsonResult;
                               });

            asyncDelegation.Go();
        }
Example #28
0
        private string RESTSave(ClientContext clientContext, string ItemData)
        {
            RestService restService = new RestService();

            return(restService.SaveItem(clientContext, "TIM_Task", ItemData));
        }
Example #29
0
 public ApiService(HttpClient httpClient)
 {
     _service = RestService.For <IApiService>(httpClient);
 }
Example #30
0
        //private TareasDbContext ctx;

        //public UsuarioService(TareasDbContext _context)
        //{
        //    ctx = _context;
        //}

        // Metodos de Usuarios (User)
        public async Task <List <Usuario> > ListUser()
        {
            var remoteService = RestService.For <IRemoteService>("https://localhost:44373/api/");

            return(await remoteService.GetAllUsuario());
        }
Example #31
0
 public static FcmInterFaceApi get_instance()
 {
     return(RestService.For <FcmInterFaceApi>(base_url));
 }
Example #32
0
 public GithubService()
 {
     apiProxy = RestService.For <IGitHubApi>(apiUrl);
 }
Example #33
0
 public CharactersService()
 {
     repo = RestService.For <IRepository>(API_BASE_URL);
 }
 public SkillEnablementApi(HttpClient httpClient)
 {
     Client = RestService.For <IClientSkillEnablementApi>(httpClient);
 }
Example #35
0
 public RestServiceClient()
 {
     this.hnapi = RestService.For <IHnapi>("http://node-hnapi.herokuapp.com/");
 }
Example #36
0
        private string RESTUpdate(ClientContext clientContext, string ItemData, string ID)
        {
            RestService restService = new RestService();

            return(restService.UpdateItem(clientContext, "TIM_SubTask", ItemData, ID));
        }
Example #37
0
 public RegisterUserPage()
 {
     service = new RestService();
     InitializeComponent();
     Init();
 }
Example #38
0
 private ISearchAPI GetAPI()
 {
     return(RestService.For <ISearchAPI>("http://10.0.2.2:3000"));//10.0.2.2 localhost
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            IHealthAPI healthAPI;

            int      itemId   = 0;
            DateTime itemDate = DateTime.Now;

            SetContentView(Resource.Layout.pulse_layout);

            healthAPI = RestService.For <IHealthAPI>(sessionUser.uriSession);
            lstData   = FindViewById <ListView>(Resource.Id.pulseList);

            LoadData();


            var btn_addPulse    = FindViewById <Button>(Resource.Id.btn_addPulse);
            var btn_deletePulse = FindViewById <Button>(Resource.Id.btn_deletePulse);
            var btn_loadPulses  = FindViewById <Button>(Resource.Id.btn_loadPulses);

            btn_loadPulses.Click += async(s, e) =>
            {
                try
                {
                    Android.Support.V7.App.AlertDialog dialog = new EDMTDialogBuilder()
                                                                .SetContext(this)
                                                                .SetMessage("Proszę czekać...")
                                                                .Build();

                    if (!dialog.IsShowing)
                    {
                        dialog.Show();
                    }

                    List <Pulse> pulses = await healthAPI.GetPulses();

                    lstSource = pulses.FindAll(x => x.userId == sessionUser.Id);

                    dialog.Dismiss();
                    LoadData();
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "" + ex.Message, ToastLength.Long).Show();
                }
            };

            lstData.ItemClick += (s, e) =>
            {
                for (int i = 0; i < lstData.Count; i++)
                {
                    if (e.Position == i)
                    {
                        lstData.GetChildAt(i).SetBackgroundColor(Android.Graphics.Color.DarkOrange);
                    }
                    else
                    {
                        lstData.GetChildAt(i).SetBackgroundColor(Android.Graphics.Color.Transparent);
                    }
                }

                itemId = int.Parse(e.Id.ToString());

                btn_deletePulse.Enabled = true;
            };

            btn_addPulse.Click += (s, e) =>
            {
                Intent nextActivity = new Intent(this, typeof(AddPulseActivity));
                Finish();
                StartActivity(nextActivity);
            };

            btn_deletePulse.Click += async(s, e) =>
            {
                await healthAPI.DeletePulse(itemId);

                LoadData();
            };
        }
Example #40
0
        private List <NieuwsEntiteit> getNieuws()
        {
            RestService con = new RestService();

            return(con.VerkrijgNieuws().Result);
        }
Example #41
0
        public async Task <Usuario> SelectUser(int id)
        {
            var remoteService = RestService.For <IRemoteService>("https://localhost:44373/api/");

            return(await remoteService.GetUsuario(id));
        }
Example #42
0
        public static async Task <List <Images> > GetWaifus(int page)
        {
            IWaifuService waifuService = RestService.For <IWaifuService>(Constans.UrlApi);

            try
            {
                var data = await waifuService.GetWaifus(page);

                var users = new List <User>
                {
                    new User {
                        IdUser = 1, Name = "Judas3991", ImgProfile = "https://cdn.myanimelist.net/images/userimages/9128492.jpg?t=1604347800"
                    },
                    new User {
                        IdUser = 3, Name = "Patricia", ImgProfile = "https://randomuser.me/api/portraits/women/54.jpg"
                    },
                    new User {
                        IdUser = 4, Name = "Joan", ImgProfile = "https://randomuser.me/api/portraits/men/24.jpg"
                    },
                    new User {
                        IdUser = 8, Name = "Angie", ImgProfile = "https://randomuser.me/api/portraits/women/13.jpg"
                    },
                    new User {
                        IdUser = 9, Name = "Jennifer", ImgProfile = "https://randomuser.me/api/portraits/women/18.jpg"
                    },
                    new User {
                        IdUser = 12, Name = "Luz Marina", ImgProfile = "https://randomuser.me/api/portraits/women/17.jpg"
                    },
                    new User {
                        IdUser = 13, Name = "Ana Maria", ImgProfile = "https://randomuser.me/api/portraits/women/91.jpg"
                    },
                    new User {
                        IdUser = 14, Name = "Lucia", ImgProfile = "https://randomuser.me/api/portraits/women/65.jpg"
                    },
                    new User {
                        IdUser = 17, Name = "Carmen", ImgProfile = "https://randomuser.me/api/portraits/women/64.jpg"
                    },
                    new User {
                        IdUser = 18, Name = "Jose", ImgProfile = "https://randomuser.me/api/portraits/men/46.jpg"
                    },
                    new User {
                        IdUser = 19, Name = "Rosa", ImgProfile = "https://randomuser.me/api/portraits/women/70.jpg"
                    },
                    new User {
                        IdUser = 20, Name = "Sandra", ImgProfile = "https://randomuser.me/api/portraits/women/0.jpg"
                    },
                };

                data.Data.ForEach(w => {
                    var user = users.FirstOrDefault(u => u.IdUser == w.IdUser);
                    w.User   = user ?? new User {
                        IdUser = 7, Name = "Francisco Javier", ImgProfile = "https://randomuser.me/api/portraits/men/3.jpg"
                    };
                });
                return(data.Data);
            }
            catch (System.Exception ex)
            {
                throw new System.Exception(ex.Message);
            }
        }
Example #43
0
 public void SetServer()
 {
     _ServerAPI = RestService.For <ServerAPI>("http://" + Global.IP + ":" + Global.Port);
 }
Example #44
0
        public async Task <List <Tarea> > GetAll()
        {
            var remoteService = RestService.For <IRemotService>("https://localhost:44362/api");

            return(await remoteService.GetAllTareas());
        }
Example #45
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            info.Text   = "";
            Lugar.Text  = Partido.Lugar;
            Precio.Text = Partido.Precio.ToString() + "€";
            Pista.Text  = "Nº" + Partido.Pista.ToString();
            Fecha.Text  = Partido.Fecha;
            HoraI.Text  = Partido.HoraI;
            HoraF.Text  = Partido.HoraF;
            Nivel.Text  = Partido.Nivel;

            RestService restService = new RestService();
            string      Url         = "http://47.62.12.161:54321/api_bsport/select/jugadores_partido.php";

            Datos datos = await restService.Post <Datos>(Url, new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("Id_partido", Partido.Id_Partido.ToString()) });

            if (datos != null)
            {
                switch (datos.Codigo)
                {
                case 1:

                    switch (Partido.NJugadores)
                    {
                    case 1:
                        J1.Text = datos.Usuarios[0].Nombre;
                        break;

                    case 2:
                        stackJ2.IsVisible = true;
                        J2.Text           = datos.Usuarios[1].Nombre;
                        goto case 1;

                    case 3:
                        stackJ3.IsVisible = true;
                        J3.Text           = datos.Usuarios[2].Nombre;
                        goto case 2;

                    case 4:
                        stackJ4.IsVisible = true;
                        J4.Text           = datos.Usuarios[3].Nombre;
                        goto case 3;
                    }
                    break;

                case 101:
                    Console.WriteLine("101");
                    info.TextColor = Color.IndianRed;
                    info.Text      = datos.Mensaje.ToString();
                    break;

                case 102:
                    Console.WriteLine("102");
                    info.TextColor = Color.IndianRed;
                    info.Text     += datos.Mensaje.ToString();
                    break;

                case 103:
                    Console.WriteLine("103");
                    info.TextColor = Color.IndianRed;
                    info.Text      = datos.Mensaje.ToString();
                    break;

                case 104:
                    Console.WriteLine("104");
                    info.TextColor = Color.IndianRed;
                    info.Text      = datos.Mensaje.ToString();
                    break;

                case 105:
                    Console.WriteLine("105");
                    info.TextColor = Color.IndianRed;
                    info.Text      = datos.Mensaje.ToString();
                    break;
                }
            }
        }
Example #46
0
        public async Task <Tarea> Remove(int id)
        {
            var remoteService = RestService.For <IRemotService>("https://localhost:44362/api");

            return(await remoteService.DeleteTarea(id));
        }
Example #47
0
 public TvMazeClient(ILogger <TvMazeClient> logger)
 {
     _logger = logger;
     _client = RestService.For <ITvMaze>("http://api.tvmaze.com/");
 }
Example #48
0
 public RestClient(string uriFormat, RestService service)
 {
     _uriFormat = uriFormat;
     _service = service;
 }
 public RefitService()
 {
     _server = RestService.For <IServerService>(
         AppConfig.RestApiBaseUrl
         );
 }
        /* public async Task<bool> Remove(int id)
         * {
         *
         *   var entidad = await context.Detalles.Where(i => i.id == id).SingleAsync();
         *   context.Detalles.Remove(entidad);
         *   await context.SaveChangesAsync();
         *   return true;
         *
         * }*/

        public async Task <Detalles> Remove(int id)
        {
            var remoteService = RestService.For <RemoteService>("https://localhost:44357/api/");

            return(await remoteService.BorrarDetalle(id));
        }
Example #51
0
        public async Task <decimal> Get()
        {
            var api = RestService.For <IRetornaTaxaApi>("http://retornataxawebapi:80");

            return(await api.Get());
        }
Example #52
0
 public static IAppApiProtocol AppApiService()
 {
     return(RestService.For <IAppApiProtocol>(PixivApi(ProtocolBase.AppApiBaseUrl, Settings.Global.DirectConnect)));
 }
Example #53
0
 public RestClient(string uriFormat, RestService service, IRestUriTransformer uriTransformer)
     : this(uriFormat, service)
 {
     _uriTransformer = uriTransformer;
 }
 static async Task MainAsync()
 {
     var gitHubApi = RestService.For <IUserApi>("https://localhost:5001");
     var user      = await gitHubApi.GetUserByLoginName("XXXX");
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            userEditInfoTableView.RowHeight       = 120;
            userEditInfoTableView.ContentInset    = new UIEdgeInsets(100, 0, 0, 0);
            userEditInfoTableView.TableFooterView = new UIView(CGRect.Empty); // Remove empty cells
            GetTableViewData(User, SharedImage, this);

            AddBackground();

            saveButton = new UIBarButtonItem()
            {
                Title = "Save"
            };

            saveButton.Clicked += async(sender, e) =>
            {
                LoadingOverlay.ShowOverlay(this.View);

                var listUserEditedInfo = EditProfileSharedData.EditedUserInfo;

                string userFirstName = listUserEditedInfo[0];
                string userLastName  = listUserEditedInfo[1];
                string userEmail     = listUserEditedInfo[2];
                string userPassword  = listUserEditedInfo[3];

                if (string.IsNullOrEmpty(userFirstName) || string.IsNullOrEmpty(userLastName))
                {
                    LoadingOverlay.RemoveOverlay();
                    DisplayAlertMessage("All fields are required to fill in");
                    return;
                }

                // If email or password do not meet requirements
                if (string.IsNullOrWhiteSpace(userEmail))
                {
                    LoadingOverlay.RemoveOverlay();
                    DisplayAlertMessage("Email is required to fill in");
                    return;
                }

                if (!Validation.ValidationResult(userEmail, "email"))
                {
                    LoadingOverlay.RemoveOverlay();
                    DisplayAlertMessage(Validation.Message);
                    return;
                }

                if (!string.IsNullOrEmpty(userPassword))
                {
                    if (!Validation.ValidationResult(userPassword, "password"))
                    {
                        LoadingOverlay.RemoveOverlay();
                        DisplayAlertMessage(Validation.Message);
                        return;
                    }
                }

                saveButton.Enabled = false;

                var userRepository = new UsersRepository();
                var updatedUser    = new UsersModel()
                {
                    Id            = User.Id,
                    FirstName     = userFirstName,
                    LastName      = userLastName,
                    Email         = userEmail.ToLower(),
                    Password      = userPassword,
                    Avatar        = await ConvertImage.ConvertImageToBinary(SharedImage),
                    LoginProvider = User.LoginProvider,
                    CreatedAt     = User.CreatedAt
                };

                // Call REST service to send Json data
                RestService rs = new RestService();

                // Get Json data from server in JsonResponseModel format
                Task <UsersModel> jsonResponeTask = rs.UserLoginAndRegisterJson(updatedUser, "update");

                // If there was an error in PostJsonDataAsync class, display message
                if (jsonResponeTask == null)
                {
                    LoadingOverlay.RemoveOverlay();
                    DisplayAlertMessage(rs.Message);
                    return;
                }

                // Get user id from Json after login or display an error
                // Create instance of JsonResponseModel and pass jsonResponeTask there
                var jsonResponse = await jsonResponeTask;

                // Get user id from Json after update or display an error
                if (jsonResponse.Status == "Error")
                {
                    LoadingOverlay.RemoveOverlay();
                    DisplayAlertMessage(jsonResponse.Message);
                    return;
                }
                else
                {
                    Console.WriteLine(jsonResponse.Message);
                }

                await userRepository.UpdateUser(updatedUser); // Update in local database

                User = updatedUser;                           // Send back to UserProfileViewController to update data there

                LoadingOverlay.RemoveOverlay();
                saveButton.Enabled = true;
                this.NavigationController.PopViewController(true);
            };

            this.NavigationItem.SetRightBarButtonItem(saveButton, true);
        }
Example #56
0
 /// <summary>
 /// Stop the rest service
 /// </summary>
 public void Stop()
 {
     this.m_serviceHost?.Stop();
     this.m_serviceHost = null;
 }
Example #57
0
        public async Task <Usuario> SaveUser(Usuario value)
        {
            var remoteService = RestService.For <IRemoteService>("https://localhost:44373/api/");

            return(await remoteService.GuardarUsuario(value));
        }
Example #58
0
 public RestBuzzService()
 {
     _buzzClient = RestService.For <IRefitBuzzContract>("http://rest.buzz.localhost");
 }
Example #59
0
 public JsonResult EtkinlikKayit(EtkinlikKayitModel kayitData)
 {
     Response response = new Response();
     if (kayitData.userName == null)
     {
         return Json(response.AuthorizeError());
     }
     RestService service = new RestService();
     var request = new RestRequest("api/EtkinlikUsers", Method.POST);
     request.AddParameter("UserId",kayitData.userName);
     request.AddParameter("EtkinlikId", kayitData.etkinlikId);
     request.AddParameter("CheckIn", false);
     request.AddParameter("CheckOut", false);
     request.AddParameter("CekilisKabul", false);
     var token = Request.Headers["Authorization"];
     var result = service.Execute<Object>(request, token);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Example #60
0
        public async void SubmitData()
        {
            Boolean boolisValid = await IsValid();

            if (boolisValid)
            {
                Alogin.IsRunning = true;
                Alogin.IsVisible = true;

                if (pageinfo == "forgetpassword")
                {
                    try
                    {
                        string OTPNumber = otpnumber.Text;
                        string Inputs    = "UserID=" + userid + "&OTP=" + OTPNumber;
                        string resp      = await RestService.RegistrationOTP(Inputs);

                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject <string>(resp);


                        if (result == "1")
                        {
                            await Navigation.PopPopupAsync();

                            await Navigation.PushAsync(new ReSetPassword(userid));

                            Alogin.IsRunning = false;
                            Alogin.IsVisible = false;
                        }
                        else if (result == "0")
                        {
                            await DisplayAlert("Alert", "OTP Expired Please Resend", "Ok");

                            Alogin.IsRunning = false;
                            Alogin.IsVisible = false;
                        }
                        else if (result == "-1")
                        {
                            await DisplayAlert("Alert", "Wrong OTP", "Ok");

                            // await Navigation.PopPopupAsync();
                            //  await Navigation.PushAsync(new SetPassword(userid));
                            Alogin.IsRunning = false;
                            Alogin.IsVisible = false;
                        }
                        else
                        {
                            await DisplayAlert("Alert", "Network Issue..!", "Ok");

                            Alogin.IsRunning = false;
                            Alogin.IsVisible = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex);
                        Alogin.IsRunning = false;
                        Alogin.IsVisible = false;
                    }
                }
                else if (pageinfo == "setpassword")
                {
                    try
                    {
                        string OTPNumber = otpnumber.Text;
                        string Inputs    = "UserID=" + userid + "&OTP=" + OTPNumber;
                        string resp      = await RestService.RegistrationOTP(Inputs);

                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject <string>(resp);


                        if (result == "1")
                        {
                            await Navigation.PopPopupAsync();

                            await Navigation.PushAsync(new SetPassword(userid));

                            Alogin.IsRunning = false;
                            Alogin.IsVisible = false;
                        }
                        else if (result == "0")
                        {
                            await DisplayAlert("Alert", "OTP Expired Please Resend", "Ok");

                            Alogin.IsRunning = false;
                            Alogin.IsVisible = false;
                        }
                        else if (result == "-1")
                        {
                            await DisplayAlert("Alert", "Wrong OTP", "Ok");

                            // await Navigation.PopPopupAsync();
                            //  await Navigation.PushAsync(new SetPassword(userid));
                            Alogin.IsRunning = false;
                            Alogin.IsVisible = false;
                        }
                        else
                        {
                            await DisplayAlert("Alert", "Network Issue..!", "Ok");

                            Alogin.IsRunning = false;
                            Alogin.IsVisible = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex);
                        Alogin.IsRunning = false;
                        Alogin.IsVisible = false;
                    }
                }
            }
        }