I have a remote web service that returns me two int values namely:
- Frequency
- Conserve
I have a model defined as Parameters
that is as follows :
public class Parameters
{
public int Frequency { get; set; }
public int Conserve { get; set; }
}
On each start of the application, a call is made to the web service to get the values. At the first launch of the app, the values are saved in to an sqlite database.
Subsequently, after each start of the application, a call is made to the web service to get the values. Each and every time the values are saved to the sqlite db.
The method that does is:
public async Task InsertParams()
{
await con.CreateTableAsync<Parameters>();
ParamService ps = new ParamService();
Parameters pm = new Parameters();
pm = await ps.GetParams(); // call to webservice
await con.InsertOrReplaceAsync(pm);
}
The issue is that if initially the value of frequency is 30
on the web service, it inserts it in the db. But when the value changes to 50
, it does not override the row in the sqlite db.
I want only a single row in the sqlite db that should be overriden /replace. Please advise how can I achieve this. Thanks.