PageRenderTime 2ms CodeModel.GetById 42ms app.highlight 17ms RepoModel.GetById 1ms app.codeStats 0ms

/collegeCompanionApp/collegeCompanionApp/Controllers/HomeController.cs

https://bitbucket.org/daniel_tapia/collegecompanion
C# | 813 lines | 433 code | 103 blank | 277 comment | 36 complexity | 682cc2761c97743b25c1ca0095445ca0 MD5 | raw file
  1using collegeCompanionApp.Models;
  2using System;
  3using System.Collections.Generic;
  4using System.IO;
  5using System.Linq;
  6using System.Net;
  7using System.Web;
  8using System.Web.Mvc;
  9using System.Web.Script.Serialization;
 10using collegeCompanionApp.Models.ViewModel;
 11using System.Diagnostics;
 12using Newtonsoft.Json.Linq;
 13using System.Xml;
 14using System.Data.Linq;
 15using System.Text;
 16using collegeCompanionApp.Repository;
 17using Ninject;
 18using Geocoding;
 19using System.Web.UI.WebControls;
 20using Microsoft.AspNet.Identity;
 21using System.Web.Http;
 22using System.Web.Http.Description;
 23using System.Windows.Forms;
 24using System.Web.UI;
 25
 26namespace collegeCompanionApp.Controllers
 27{
 28    public class HomeController : Controller
 29    {
 30        //Global Parameters
 31        string schoolName = "";
 32        string state = "";
 33        string city = "";
 34        string accreditor = "";
 35        string ownership = "";
 36        string finLimit = "";
 37        string acceptRate = "";
 38        string degree = "";
 39        string degreeType = "";
 40        string isSaved = "";
 41        int collegeCount = 0;
 42        //private Page page;
 43
 44
 45        //Adding in the repository pattern connection
 46        private readonly ICollegeRepository _repository;
 47
 48        public HomeController(ICollegeRepository repo)
 49        {
 50            _repository = repo;
 51        }
 52
 53        //An empty controller so the site will work when not passing in the repository.
 54        public HomeController(){}
 55
 56        /// <summary>
 57        /// Home page of the website. Enables search via javascript: FormSearch.js. 
 58        /// Also connects to DegreeQuiz via quizForm.js
 59        /// </summary>
 60        /// <returns>
 61        /// A view.
 62        /// </returns>
 63        public ActionResult Index()
 64        {
 65            return View();
 66        }
 67
 68        /// <summary>
 69        /// DegreeQuiz page of the website. Functionality via quizForm.js
 70        /// </summary>
 71        /// <returns>
 72        /// A view.
 73        /// </returns>
 74        public ActionResult DegreeQuiz()
 75        {
 76            return View();
 77        }
 78
 79        /// <summary>
 80        /// Error page of the website. 
 81        /// </summary>
 82        /// <returns>
 83        /// A view.
 84        /// </returns>
 85        public ActionResult Error()
 86        {
 87            return View();
 88        }
 89
 90        /// <summary>
 91        /// Travel page of the website. Enables WalkScore via TravelSearch.js.
 92        /// Also connects to map via googleSearch.js.
 93        /// </summary>
 94        /// <returns>
 95        /// A view.
 96        /// </returns>
 97        public ActionResult Travel()
 98        {
 99            var userName = User.Identity.Name;
100            var userId = User.Identity.GetUserId();
101            if (userId == null)
102            {
103                return RedirectToAction("Login", "Account");
104            }
105            else
106            {
107                return View(_repository.GetSavedColleges(userName));
108            }
109        }
110
111        /// <summary>
112        /// SearchesMenu page of the website. Enables an accordion via accordion.js.
113        /// Connects to other pages: Travel, Demographic & Yelp.
114        /// </summary>
115        /// <returns>
116        /// A view.
117        /// </returns>
118        public ActionResult SearchesMenu()
119        {
120            return View();
121        }
122
123        /// <summary>
124        /// About page of the website. 
125        /// </summary>
126        /// <returns>
127        /// A view.
128        /// </returns>
129        public ActionResult About()
130        {
131            return View();
132        }
133
134        /// <summary>
135        /// Contact page of the website.
136        /// </summary>
137        /// <returns>
138        /// A view.
139        /// </returns>
140        public ActionResult Contact()
141        {
142            return View();
143        }
144
145        /// <summary>
146        /// DELETE: api/SearchResults/5
147        /// </summary>
148        /// <returns>
149        /// A view.
150        /// </returns>
151        [ResponseType(typeof(SearchResult))]
152        public ActionResult Delete(int id)
153        {
154            if (User.Identity.IsAuthenticated)
155            {
156                SearchResult searchResult = _repository.FindCollege(id);
157                if (searchResult == null)
158                {
159                    Debug.WriteLine("Error for Delete() method.");
160                    return RedirectToAction("SaveDataList", "Home");
161                }
162
163                _repository.DeleteCollege(searchResult);
164                _repository.SaveCollege(searchResult);
165
166                return RedirectToAction("SaveDataList", "Home");
167            } else
168            {
169                return RedirectToAction("Login", "Account");
170            }
171        }
172
173        /// <summary>
174        /// SaveDataList page of the website, it presents the list of saved colleges
175        /// for a given user.
176        /// </summary>
177        /// <returns>
178        /// A view.
179        /// </returns>
180        public ActionResult SaveDataList()
181        {
182            if (User.Identity.IsAuthenticated)
183            {
184                Debug.WriteLine("SaveDataList() Method!");
185
186                if (ModelState.IsValid)
187                {
188                    return View(_repository.GetSavedColleges(User.Identity.Name));
189                }
190                else
191                {
192                    Debug.WriteLine("Error for SaveDataList() method.");
193                    return View();
194                }
195            }
196            else
197            {
198                return RedirectToAction("Login", "Account");
199            }
200
201        }
202		
203		
204		//****************************************************WalkScore*******************************************************//
205        /// <summary>
206        /// Searches for ratings of Walking, Transit & Bike for a given city using Walk Score API.
207        /// </summary>
208        /// <returns>
209        /// A "Content" result of JSON String with ratings within the requested city.
210        /// </returns>
211        public ActionResult WalkScoreSearch()
212        {
213            //Get user input data from Javascript file "TravelSearch.js"
214            var street = Request.QueryString["addressInput"];
215            var city = Request.QueryString["cityInput"];
216            var state = Request.QueryString["stateInput"];
217            var zipcode = Request.QueryString["zipInput"];
218            var lat = Request.QueryString["latitude"];
219            var lon = Request.QueryString["longitude"];
220            var location = street + city + state + zipcode;
221
222            location = location.Replace(" ", "%20");
223
224            //User Stringbuilder to make a URL for the request.
225            StringBuilder sb = new StringBuilder();
226            sb.Append("http://api.walkscore.com/score?format=json&");
227            sb.Append("&address=" + location);
228            sb.Append("&lon=" + lon);
229            sb.Append("&lat=" + lat);
230            sb.Append("&transit=1&bike=1");
231            sb.Append("&wsapikey=");
232            sb.Append(System.Web.Configuration.WebConfigurationManager.AppSettings["WalkScoreAPIKey"]);
233            Debug.WriteLine(sb.ToString());
234
235            // Make a web request to get the list of classes.
236            WebRequest request = HttpWebRequest.Create(sb.ToString()); //Takes an arguement of the URL of the webserver being targeted.
237            // Using a web response process the file returned from the API.
238            WebResponse response = request.GetResponse();
239
240            string resultString;
241            using (var reader = new StreamReader(response.GetResponseStream()))
242            {
243                // Get the data from the stream reader to parse data into usable format
244                resultString = reader.ReadToEnd();
245            }
246            //Note: This is completed without a JSON parse action so don't treat it like the other methods! lol
247            return Content(resultString, "application/json");
248        }
249
250
251        //****************************************************College Search*******************************************************//
252
253        /// <summary>
254        /// SearchForm page of the website. This page presents multiple input/selector fields the user
255        /// can alter to get back a college search result on the SearchResults.cshtml page.
256        /// </summary>
257        /// <returns>
258        /// A view.
259        /// </returns>
260        public ActionResult SearchForm()
261        {
262            return View(_repository.GetFormData());
263        }
264
265        /// <summary>
266        /// SearchResults page of the website. This page takes the results of the API call and presents
267        /// them in a pleasing format via the SearchResults.js file.
268        /// </summary>
269        /// <returns>
270        /// A view.
271        /// </returns>
272        public ActionResult SearchResults()
273        {            
274            return View(_repository.GetAllUsers());
275        }
276
277        /// <summary>
278        /// Searches for Colleges via an API call.
279        /// </summary>
280        /// <returns>
281        /// A JSON result of colleges within the requested confines.
282        /// </returns>
283        public JsonResult Search()
284        {
285            Debug.WriteLine("SearchForm() Method!");
286
287            //Get Data from Current URL
288            schoolName = Request.QueryString["school.name"];
289            state = Request.QueryString["school.state"];
290            city = Request.QueryString["school.city"];
291            accreditor = Request.QueryString["school.accreditor"];
292            ownership = Request.QueryString["school.ownership"];
293            finLimit = Request.QueryString["school.tuition"];
294            acceptRate = Request.QueryString["school.admission_rate"];
295            degree = Request.QueryString["school.degree"];
296            degreeType = Request.QueryString["school.degreeType"];
297
298            // build a WebRequest
299            WebRequest request = WebRequest.Create(CreateURL(schoolName, state, city, accreditor, ownership, finLimit, acceptRate, degree, degreeType));
300            WebResponse response = request.GetResponse();
301            Stream dataStream = response.GetResponseStream();
302            StreamReader reader = new StreamReader(response.GetResponseStream());
303
304            // Read the content.  
305            string responseFromServer = reader.ReadToEnd();
306
307            // Clean up the streams and the response.  
308            reader.Close();
309            response.Close();
310
311            // Create a JObject, using Newtonsoft NuGet package
312            JObject json = JObject.Parse(responseFromServer);
313
314            // Create a serializer to deserialize the string response (string in JSON format)
315            JavaScriptSerializer serializer = new JavaScriptSerializer();
316
317            // Store JSON results in results to be passed back to client (javascript)
318            var data = serializer.DeserializeObject(responseFromServer);
319
320            //saveData(schoolName, state, city, accreditor, ownership, finLimit);
321
322            //return CollegeSearch(college);
323            return Json(data, JsonRequestBehavior.AllowGet);
324        }
325
326        /// <summary>
327        /// Saves selected data into the College Database
328        /// If the college already exists it throws a pop up error to the user.
329        /// </summary>
330        public ActionResult SaveData()
331        {
332            int userID = Int32.Parse(Request.QueryString["UserID"]);
333            string name = Request.QueryString["Name"];
334            string stateName = Request.QueryString["StateName"];
335            string city = Request.QueryString["City"];
336            int zipCode = Int32.Parse(Request.QueryString["ZipCode"]);
337            string accreditor = Request.QueryString["Accreditor"];
338            string degree = Request.QueryString["Degree"];
339            string degreeType = Request.QueryString["DegreeType"];
340            int ownership = Int32.Parse(Request.QueryString["Ownership"]);
341            int cost;
342
343            int.TryParse(Request.QueryString["Cost"], out cost);
344
345            if (_repository.GetCollege(name, userID) == 0) { 
346                SearchResult college = new SearchResult {
347                                                            CompanionID = userID,
348                                                            Name = name,
349                                                            StateName = stateName,
350                                                            City = city,
351                                                            ZipCode = zipCode,
352                                                            Accreditor = accreditor,
353                                                            Degree = degree,
354                                                            DegreeType = degreeType,
355                                                            Ownership = ownership,
356                                                            Cost = cost
357                };
358
359                if (User.Identity.IsAuthenticated)
360                {
361                    Debug.WriteLine("saveData() Method!");
362
363                    if (ModelState.IsValid)
364                    {
365
366                        collegeCount = _repository.GetSavedColleges(User.Identity.Name).Count();
367
368                        _repository.AddCollege(college);
369
370                        _repository.SaveCollege(college);
371
372                        isSaved = "Not Saved";
373
374                        return RedirectToAction("SaveDataList", "Home");
375                    }
376                    else
377                    {
378                        Debug.WriteLine("Error for SaveData() method.");
379                        return View();
380                    }
381                }
382                else
383                {
384                    return RedirectToAction("Login","Account");
385                }
386            }
387            else
388            {
389                isSaved = "Saved";
390                return RedirectToAction("SaveDataList", "Home");
391                
392            }
393        }
394
395
396
397        /// <summary>
398        /// Creats a URL for the API search based on User Input.
399        /// </summary>
400        /// <param name="acceptRate">The acceptance rate of the college.</param>
401        /// <param name="cityName">The city the college is located in.</param>
402        /// <param name="degree">The degree selected by the user.</param>
403        /// <param name="accreditor">The accreditory for the school.</param>
404        /// <param name="degreeType">The type of degree selected by the user.</param>
405        /// <param name="finLimit">The finanicial limit selected by the user.</param>
406        /// <param name="ownership">The ownership status of the school: Public, Private For Profit, Private NonProfit.</param>
407        /// <param name="schoolName">The school's name.</param>
408        /// <param name="stateName">The school's state of location.</param>
409        /// <returns>
410        /// A URL string.
411        /// </returns>
412        public string CreateURL(string schoolName, string stateName, string cityName, string accreditor, string ownership, string finLimit, string acceptRate, string degree, string degreeType)
413        {
414            Debug.WriteLine("createURL() Method!");
415
416            var source = "https://api.data.gov/ed/collegescorecard/v1/schools?"; // Source, Endpoint
417            var APIKey = "&api_key=" + System.Web.Configuration.WebConfigurationManager.AppSettings["CollegeScoreCardAPIKey"]; // CollegeScoreCard API Key
418            var fields = SetCollegeFields(); // Set Fields
419            var values = SetCollegeValues(ownership, acceptRate, finLimit); // Set Values, Parameters
420
421            // Checks for Empty Values
422            // If not empty, add to parameters
423            if (schoolName != "")
424            {
425                values = values + "&school.name=" + schoolName;
426            }
427            if (stateName != "")
428            {
429                values = values + "&school.state=" + stateName;
430            }
431            if (cityName != "")
432            {
433                values = values + "&school.city=" + cityName;
434            }
435            if (cityName != "")
436            {
437                values = values + "&school.city=" + cityName;
438            }
439            if (accreditor != "")
440            {
441                values = values + "&school.accreditor=" + accreditor;
442            }
443            if (degree != "" && degree != "Any")
444            {
445                string theDegree = SetDegree(degreeType, degree); // Set up Degree value
446                values = values + AddDegreeValue(theDegree); // Add Degree to Parameters
447                fields = fields + AddDegreeField(theDegree); // Add Degree to Fields
448            }
449
450            //Set up GET URL to College Scorecard
451            string url = source + values + APIKey + fields;
452            //Replace spaces with %20 
453            url = url.Trim();
454            url = url.Replace(" ", "%20");
455            Debug.WriteLine("URL: " + url);
456
457            return url;
458        }
459
460        /// <summary>
461        /// A method to ensure colelge fields are set up correctly in the URL string.
462        /// </summary>
463        /// <returns>
464        /// A string of fields for the URL call.
465        /// </returns>
466        public string SetCollegeFields()
467        {
468            // Default Fields to get
469            return "&_fields=school.name,school.state,school.city,school.accreditor,school.ownership,school.tuition_revenue_per_fte,2015.admissions.admission_rate.overall,school.school_url,school.zip&_per_page=100";
470        }
471
472        /// <summary>
473        /// A method to set selected fields to the entered values of the user.
474        /// </summary>
475        /// <param name="acceptRate">The selected acceptance rate.</param>
476        /// <param name="finLimit">The selected financial limit.</param>
477        /// <param name="ownership">The selected ownership.</param>
478        /// <returns>
479        /// A string for the URL call.
480        /// </returns>
481        public string SetCollegeValues(string ownership, string acceptRate, string finLimit)
482        {
483            string collegeValues = "school.ownership=" + ownership + "&2015.admissions.admission_rate.overall__range=" + acceptRate
484                + "&school.tuition_revenue_per_fte__range=" + finLimit + "&_sort=school.tuition_revenue_per_fte:desc"; // Default Parameters
485            return collegeValues;
486        }
487
488        /// <summary>
489        /// A method to append the degree type to the degree category in the format the API desires.
490        /// </summary>
491        /// <param name="theDegree">The degree category.</param>
492        /// <returns>
493        /// A string for the URL call.
494        /// </returns>
495        public string AddDegreeField(string theDegree)
496        {
497            string field = "," + theDegree; // Add Degree to fields
498            return field;
499        }
500
501        /// <summary>
502        /// A method to add a range to the degree is necessary.
503        /// </summary>
504        /// <param name="theDegree">Gets the selected type to append the data around.</param>
505        /// <returns>
506        /// A string for the URL call.
507        /// </returns>
508        public string AddDegreeValue(string theDegree)
509        {
510            string val = "&" + theDegree + "__range=1.."; // Add Degree to parameters
511            return val;
512        }
513
514        /// <summary>
515        /// A method to set up the degree string to set it.
516        /// </summary>
517        /// <param name="degree">The degree field.</param>
518        /// <param name="degreeType">The degree type.</param>
519        /// <returns>
520        /// A string for the URL call.
521        /// </returns>
522        public string SetDegree(string degreeType, string degree)
523        {
524            string aDegree = "2015.academics.program." + degreeType + "." + degree; // Degree to Search
525            return aDegree;
526        }
527
528
529        //****************************************************Yelp*******************************************************//
530
531        /// <summary>
532        /// Yelp page for the website.
533        /// </summary>
534        /// <returns>
535        /// A view.
536        /// </returns>
537        public ActionResult Yelp()
538        {
539            var userName = User.Identity.Name;
540            var userId = User.Identity.GetUserId();
541            if (userId == null)
542            {
543                return RedirectToAction("Login", "Account");
544            }
545            else
546            {
547                return View(_repository.GetSavedColleges(userName));
548            }
549        }
550
551        /// <summary>
552        /// A search method for the Yelp API call. This runs via the YelpSearch.js.
553        /// </summary>
554        /// <returns>
555        /// A JSON result for the API call.
556        /// </returns>
557        public JsonResult YelpSearch()
558        {
559            Debug.WriteLine("YelpSearch() Method!");
560
561            //Get Yelp API Key
562            string YelpAPIKey = System.Web.Configuration.WebConfigurationManager.AppSettings["YelpAPIKey"];
563            YelpAPIKey = IsAPIKey(YelpAPIKey);
564            //Get Location
565            string location = GetLocation(Request.QueryString["location"]);
566            //Get Term
567            string term = GetTerm(Request.QueryString["term"]);
568            //Get IsOpen
569            string isOpen = Request.QueryString["isOpen"];
570            //Set Parameters
571            string param = SetParam(location, term, isOpen);
572            //URL Endpoint
573            var url = SetURL(param);
574
575            //URL GET Request
576            Debug.WriteLine("URL: " + url);
577
578            // build a WebRequest
579            WebRequest request = WebRequest.Create(url);
580            request.Headers.Add("Authorization", "Bearer " + YelpAPIKey);
581            WebResponse response = request.GetResponse();
582            Stream dataStream = response.GetResponseStream();
583            StreamReader reader = new StreamReader(response.GetResponseStream());
584
585            // Read the content.  
586            string responseFromServer = reader.ReadToEnd();
587
588            // Clean up the streams and the response.  
589            reader.Close();
590            response.Close();
591
592            // Create a JObject, using Newtonsoft NuGet package
593            JObject json = JObject.Parse(responseFromServer);
594
595            // Create a serializer to deserialize the string response (string in JSON format)
596            JavaScriptSerializer serializer = new JavaScriptSerializer();
597
598            // Store JSON results in results to be passed back to client (javascript)
599            var data = serializer.DeserializeObject(responseFromServer);
600
601            return Json(data, JsonRequestBehavior.AllowGet);
602        }
603
604
605        /// <summary>
606        /// A simple method to test if something is an API key or not.
607        /// </summary>
608        /// <param name="key">The API key being tested.</param>
609        /// <returns>
610        /// The API key if successful, or "NoKey" if not.
611        /// </returns>
612        public string IsAPIKey(string key)
613        {
614            if (key.Length <= 5)
615            {
616                key = "NoKey";
617            }
618            return key;
619        }
620
621        /// <summary>
622        /// A simple method to test if a location if being populated or not.
623        /// </summary>
624        /// <param name="location">The location being tested.</param>
625        /// <returns>
626        /// The location if it is not null, otherwise it throws a debug statement that it is null.
627        /// </returns>
628        public string GetLocation(string location)
629        {
630            if (location == null)
631            {
632                Debug.WriteLine("No Location");
633            }
634            return location;
635        }
636
637        /// <summary>
638        /// A method to set null term strings to empty strings to avoid errors with the API.
639        /// </summary>
640        /// <param name="term">The term being tested/converted.</param>
641        /// <returns>
642        /// An empty string if the term was null.
643        /// </returns>
644        public string GetTerm(string term)
645        {
646            if (term == null)
647            {
648                term = "";
649            }
650            return term;
651        }
652
653        /// <summary>
654        /// A method to create a parameter string for the geolocation.
655        /// </summary>
656        /// <param name="location">The location field.</param>
657        /// <param name="term">The term field.</param>
658        /// <returns>
659        /// The resulting string for the URL.
660        /// </returns>
661        public string SetParam(string location, string term, string isOpen)
662        {
663            var param = "term=" + term + "&location=" + location + "&limit=12&sort_by=distance&open_now=";
664
665            if(isOpen == "Open")
666            {
667                param = param + "true";
668            }
669            else
670            {
671                param = param + "false";
672            }
673
674            return param;
675        }
676
677        /// <summary>
678        /// A simple method to set the URL for the yelp search.
679        /// </summary>
680        /// <param name="param">A parameter upon which the search is run.</param>
681        /// <returns>
682        /// The resulting parameter URL string.
683        /// </returns>
684        public string SetURL(string param)
685        {
686            return "https://api.yelp.com/v3/businesses/search?" + param;
687        }
688
689        
690
691        //****************************************************Demographic*******************************************************//
692
693        /// <summary>
694        /// The demographic search page. Runs with the DemographicSearch.js.
695        /// </summary>
696        /// <returns>
697        /// A view.
698        /// </returns>
699        public ActionResult Demographic()
700        {
701            var userName = User.Identity.Name;
702            var userId = User.Identity.GetUserId();
703            if (userId == null)
704            {
705                return RedirectToAction("Login", "Account");
706            }
707            else
708            {
709                FormdataDB fd = new FormdataDB();
710                LifeStyle lifeStyle = _repository.GetLifeStyleVM();
711                lifeStyle.SearchResults = _repository.GetSavedColleges(userName);
712                lifeStyle.DemoAges = _repository.GetFormData().DemoAges;
713                lifeStyle.DemoRaces = _repository.GetFormData().DemoRaces;
714                return View(lifeStyle);
715            }
716        }
717
718        /// <summary>
719        /// The DemographicSearch method to run the API call to Demographics Inquiry.
720        /// </summary>
721        /// <returns>
722        /// A JSON result for the API call.
723        /// </returns>
724        public JsonResult DemographicSearch()
725        {
726            Debug.WriteLine("DemographicSearch() Method!");
727
728            //Get Demographic API Key
729            string DemoAPIKey = System.Web.Configuration.WebConfigurationManager.AppSettings["DemographicAPIKey"];
730            //Gets the latitude & longitude
731            string coordinates = GetCoordinates(Request.QueryString["latitude"], Request.QueryString["longitude"]);
732            //Set parameters with coordinates & variables
733            string param = SetDemoParams(coordinates, Request.QueryString["variables"]);// + "/" + variables);
734            //Endpoint Description Link: https://market.mashape.com/mapfruition/demographicinquiry#inquire-by-point
735            //Set up url endpoint with parameters
736            var url = SetDemoURL(param);
737
738            //URL GET Request
739            Debug.WriteLine("JSon URL Call: " + url);
740
741            // build a WebRequest
742            WebRequest request = WebRequest.Create(url);
743            //Add Header with API Key
744            request.Headers.Add("X-Mashape-Key", DemoAPIKey);
745            WebResponse response = request.GetResponse();
746            Stream dataStream = response.GetResponseStream();
747            StreamReader reader = new StreamReader(response.GetResponseStream());
748
749            // Read the content.  
750            string responseFromServer = reader.ReadToEnd();
751
752            // Clean up the streams and the response.  
753            reader.Close();
754            response.Close();
755
756            // Create a JObject, using Newtonsoft NuGet package
757            JObject json = JObject.Parse(responseFromServer);
758
759            // Create a serializer to deserialize the string response (string in JSON format)
760            JavaScriptSerializer serializer = new JavaScriptSerializer();
761
762            // Store JSON results in results to be passed back to client (javascript)
763            var data = serializer.DeserializeObject(responseFromServer);
764
765            return Json(data, JsonRequestBehavior.AllowGet);
766        }
767
768
769        /// <summary>
770        /// A method to set up the URL starting parameters being serarched on.
771        /// </summary>
772        /// <param name="param">The parameter being appended by the user.</param>
773        /// <returns>
774        /// A string for the URL.
775        /// </returns>
776        public string SetDemoURL(string param)
777        {
778            string url = "https://mapfruition-demoinquiry.p.mashape.com/inquirebypoint/" + param;
779
780            return url;
781        }
782
783        /// <summary>
784        /// A method to put a slash between the coordinates and the variables.
785        /// </summary>
786        /// <param name="coordinates">The coordinates provided.</param>
787        /// <param name="variables">The variables selected.</param>
788        /// <returns>
789        /// A string for the URL call.
790        /// </returns>
791        public string SetDemoParams(string coordinates, string variables)
792        {
793            string param = coordinates + "/" + variables;
794
795            return param;
796        }
797
798        /// <summary>
799        /// A method to get coordinates based on a latitude and longitude.
800        /// </summary>
801        /// <param name="lat">The Latitutde</param>
802        /// <param name="lon">The Longitude</param>
803        /// <returns>
804        /// A string for the URL.
805        /// </returns>
806        public string GetCoordinates(string lat, string lon)
807        {
808            string cord = lat + "," + lon;
809
810            return cord;
811        }
812    }
813}