public ActionResult Create(HttpPostedFileBase gpsData, FormCollection collection) { try { MapViewModel _xy = new MapViewModel(); TextTools tools = new TextTools(); LocationStore LocStorage = new LocationStore(); StreamReader textReader = new StreamReader(gpsData.InputStream); int count = 0; while (!textReader.EndOfStream) { String TXT = textReader.ReadLine(); if (TXT.StartsWith("$GPGLL")) { LocStorage.addLocation(tools.LocationCreattor(TXT)); } count++; // Counter.Text = count.ToString(); } List<string> _theList = new List<string>(); _theList = LocStorage.printStore(); int xycount = 0; int xyz = _theList.Count(); _xy.coordinates = new string[xyz]; foreach (var item in _theList) { _xy.coordinates[xycount] = item; xycount++; } return View(_xy); } catch(Exception ex) { return View(); } }
public ActionResult Index(HttpPostedFileBase gpsData, FormCollection model) { try{ // HttpPostedFile file = (HttpPostedFile)collection.GetValue("gpsData").AttemptedValue; MapViewModel _xy = new MapViewModel(); TextTools tools = new TextTools(); LocationStore LocStorage = new LocationStore(); StreamReader textReader = new StreamReader(gpsData.InputStream); int count = 0; while (!textReader.EndOfStream) { String TXT = textReader.ReadLine(); if (TXT.StartsWith("$GPGLL")) { LocStorage.addLocation(tools.LocationCreattor(TXT)); } count++; // Counter.Text = count.ToString(); } List<string> _theList = new List<string>(); _theList = LocStorage.printStore(); int xycount = 0; int xyz = _theList.Count(); string[] coordinates = new string[xyz]; foreach (var item in _theList) // { coordinates[xycount] = item+"#"; xycount++; } {Session["xyz"] += item+"#";} return RedirectToAction("Details", coordinates); } catch (Exception ex) { return View("Details"); } }