public void ReadToClass(string path) { using (StreamReader myFile = new StreamReader(path)) { while (!myFile.EndOfStream) { My_Location L = new My_Location(); var date = myFile.ReadLine(); //ned to convert to datetime L.LocationName = myFile.ReadLine(); L.Latitude = decimal.Parse(myFile.ReadLine()); L.Longitude = decimal.Parse(myFile.ReadLine()); L.IPAddress = myFile.ReadLine(); } } }
public async Task <IActionResult> Userlication(string filename, string address, decimal latitude, decimal longitude, string ip) { My_Location my_Location = new My_Location() { LocationName = address, Date = DateTime.Now, Latitude = latitude, Longitude = longitude, IPAddress = ip }; _repo.Add(my_Location); this._repo.CreatFile(filename, address, latitude, longitude, ip); if (await _repo.Saveall()) { return(Ok()); } return(BadRequest()); }