public ChartViewModel(DetailedCountryModel country) { VisibleUC = false; if (country != null) { if (country.TimelineCases != null) { VisibleUC = true; PopulateChart(country); } } }
public void PopulateChart(DetailedCountryModel country) { SeriesCollection = new SeriesCollection { new LineSeries { Title = "Cases", Values = new ChartValues <int>(GetTimelineStat(country.TimelineCases)), } }; Labels = country.TimelineCases.Keys.Select(key => key.ToShortDateString()).ToArray(); SeriesCollection.Add(new LineSeries { Title = "Deaths", Values = new ChartValues <int>(GetTimelineStat(country.TimelineDeaths)), }); }
public DetailedViewModel(DetailedCountryModel country) { if (country != null) { this.VisibleUC = true; this.Name = country.Name; this.Population = country.Population; this.LatestCases = country.LatestCases; this.LatestDeaths = country.LatestDeaths; this.Cases = country.Cases; this.Deaths = country.Deaths; this.FlagUri = country.FlagUri; this.CFR = country.CFR; this.Infected = country.Infected; this.LastUpdated = country.LastUpdated; } else { VisibleUC = false; } }
public async Task Delete(DetailedCountryModel country) { var sqlCommand = $"delete from Countries where Id = {country.Id}"; await SQLiteDatabaseManager.NonQuery(sqlCommand, ConnectionString); }
public async Task Update(DetailedCountryModel country) { var sqlCommand = $"update Countries set LatestCases = {country.LatestCases}, LatestDeaths = {country.LatestDeaths}, Cases = {country.Cases}, Deaths = {country.Deaths}, LastUpdated = '{country.LastUpdated:s}' where Name = '{country.Name}'"; await SQLiteDatabaseManager.NonQuery(sqlCommand, ConnectionString); }
public async Task Create(DetailedCountryModel country) { var sqlCommand = $"insert into Countries (Id, Name, CountryCode, Population, LatestCases, LatestDeaths, Cases, Deaths, LastUpdated) values ({country.Id}, '{country.Name}', '{country.CountryCode}', {country.Population}, {country.LatestCases}, {country.LatestDeaths}, {country.Cases}, {country.Deaths}, '{country.LastUpdated:s}')"; await SQLiteDatabaseManager.NonQuery(sqlCommand, ConnectionString); }