public PrimitiveResponse Post(EarthquakeDto model) { var prms = new Dictionary <string, SqlParam>(); prms.Add("@StationId", new SqlParam() { Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.StationId }); prms.Add("@HarmLevel", new SqlParam() { Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.HarmLevel }); prms.Add("@EarthquakeType", new SqlParam() { Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.EarthquakeType }); var result = _baseService.ExecuteNonQuery("sp_PostEarthquake", prms); PrimitiveResponse primitiveResult; if (result > 0) { primitiveResult = new PrimitiveResponse() { ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully." }; } else { primitiveResult = new PrimitiveResponse() { ResponseCode = ResponseCodes.UpdateNotCompleted, ResponseErrorMessage = "Canceled could not be completed." }; } return(primitiveResult); }
public EarthquakeDto LoadJsonFromServer() { using (StreamReader r = new StreamReader("https://localhost:5000/home/rafal/Desktop/earthquakeApp/Models/Data/query.json")) { string json = r.ReadToEnd(); EarthquakeDto items = JsonConvert.DeserializeObject <EarthquakeDto> (json); return(items); } }
public List <Feature> GetEarthquakesFeatures() { try { EarthquakeDto EarthquakeData = JsonConvert.DeserializeObject <EarthquakeDto> (_JsonData.LoadJsonFromServer().ToString()); return(EarthquakeData.features); } catch (Exception e) { if (e.Data == null) { Console.WriteLine(e); throw; } else { EarthquakeDto EarthquakeData = JsonConvert.DeserializeObject <EarthquakeDto> (_JsonData.GetDataFromJson()); return(EarthquakeData.features); } } }
public List <Field> GetEarthquakesFields() { EarthquakeDto EarthquakeData = JsonConvert.DeserializeObject <EarthquakeDto> (_JsonData.GetDataFromJson()); return(EarthquakeData.fields); }