IEnumerator GetCountryDetails(string url) { using (UnityWebRequest www = UnityWebRequest.Get(url)) { /*www.SetRequestHeader("x-rapidapi-host", "restcountries-v1.p.rapidapi.com"); * www.SetRequestHeader("x-rapidapi-key", "89d62bcfc9msh09c9b0cd6551e3cp11a1dfjsnd72713b8ae5d");*/ // Request and wait for the desired result. yield return(www.SendWebRequest()); if (www.isNetworkError) { Debug.Log(": Error:" + www.error); } else { //Debug.Log(":\nReceived: " + www.downloadHandler.text); string json = www.downloadHandler.text; string newJson = "{ \"country\": " + json + "}"; // this is because parseing can not done with json arrayObject only support with jsonObject Debug.Log(newJson); AllCountry countryDetails = JsonUtility.FromJson <AllCountry>(newJson); //AllCountry countryDetails = JsonConvert.DeserializeObject<AllCountry>(newJson); allCountry = countryDetails; OnGetCountryDetails?.Invoke(countryDetails); } } }
// GET: ForeignCitizen/Create public ActionResult Create() { AllCountry country = new AllCountry(); ViewBag.GenderList = db.SexModels.ToList(); ViewBag.CountryAllList = country.CountryList(); return(View()); }
//GET //get all the details as per restaurant Id : user public async Task <AllDetails> GetRestaurantDetails(int id) { var eatery = await _dataRepository.Where <Restaurant>(r => r.ID == id).Include(l => l.Location).FirstAsync(); var reviews = await _dataRepository.Where <Review>(r => r.Restaurant.ID == id).Include(u => u.User).ToListAsync(); var comments = await _dataRepository.GetAll <Comment>().Include(c => c.User).ToListAsync(); //reviews var reviewsAC = new List <ReviewsAC>(); _mapper.Map(reviews, reviewsAC); //comments var commentACs = new List <CommentAC>(); List <CommentAC> comment = new List <CommentAC>(); foreach (var item in reviewsAC) { var allComments = comments.Where(k => k.ReviewID == item.ReviewId).ToList(); _mapper.Map(allComments, commentACs); comment.AddRange(commentACs); } //adding every detail to AllDetails class var details = new AllDetails { RestaurantID = id, LocationID = eatery.ID, Locations = eatery.Location, RestaurantName = eatery.RestaurantName, Description = eatery.Description, ContactNumber = eatery.ContactNumber, CuisineType = eatery.CuisineType, AverageCost = eatery.AverageCost, OpeningHours = eatery.OpeningHours, MoreInfo = eatery.MoreInfo, Reviews = reviewsAC, Comments = comment }; //location var allCity = new AllCity(); var allCountry = new AllCountry(); _mapper.Map(await _dataRepository.Where <City>(c => c.ID == eatery.Location.FirstOrDefault().CityID).FirstAsync(), allCity); _mapper.Map(await _dataRepository.Where <Country>(c => c.ID == eatery.Location.FirstOrDefault().CountryID).FirstAsync(), allCountry); details.City = allCity; details.Country = allCountry; return(details); }
private void PopulateList(AllCountry allCountry) { foreach (var item in allCountry.country) { string nameAndCode = item.alpha2Code + " " + "(" + item.name + ")"; countryList.Add(nameAndCode); //Debug.Log(nameAndCode); } foreach (var item in countryList) { Debug.Log(item); } Debug.Log("this is PopulateList mathod"); countryListDropdown.AddOptions(countryList); }
void GetcounInfo(string url) { RestSharp.RestClient client = new RestSharp.RestClient(url); client.Timeout = -1; var request = new RestRequest(Method.GET); request.AddHeader("Cookie", "__cfduid=de73afb10b16885a45ff1a8da23025d091602322209"); IRestResponse response = client.Execute(request); string json = response.Content; string newJson = "{ \"country\": " + json + "}"; // this is because parseing can not done with json arrayObject only support with jsonObject Debug.Log(newJson); AllCountry countryDetails = JsonUtility.FromJson <AllCountry>(newJson); //AllCountry countryDetails = JsonConvert.DeserializeObject<AllCountry>(newJson); allCountry = countryDetails; OnGetCountryDetails?.Invoke(countryDetails); }
// GET: ForeignCitizen/Edit/5 public ActionResult Edit(Guid?id) { AllCountry country = new AllCountry(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ForeignCitizenModel model = db.ForeignCitizenModels.Find(id); ViewBag.CountryAllList = country.CountryList(); ForeignCitizenViewModel Vmodel = new ForeignCitizenViewModel { ForignCitizenId = model.ForignCitizenId, CitizenName = model.CitizenName, FatherName = model.FatherName, MotherName = model.MotherName, PassportNo = model.PassportNo, CountryName = model.CountryName, Age = model.Age, State = model.State, Contact = model.Contact, PresenrAddress = model.PresenrAddress, Email = model.Email, DrivingLicenceNo = model.DrivingLicenceNo, PostCode = model.PostCode, City = model.City, LivingTown = model.LivingTown, Gender = model.Gender, MaritalStatus = model.MaritalStatus, PersonImage = model.PersonImage, PassportImagCopy = model.PassportImagCopy, DLicenceCopy = model.DLicenceCopy, PoliceClearImg = model.PoliceClearImg, }; return(View(Vmodel)); }