public async Task <bool> UpdateSeries(Series2 s) { try { var seriesUpdate = await GetSeriesById(s.Id); if (seriesUpdate is null) { return(false); } s = await SetObjects(s); if (s is null) { return(false); } _db.Entry(seriesUpdate).State = EntityState.Detached; _db.Update(s); await _db.SaveChangesAsync(); return(true); } catch (Exception) { throw; } }
public BindedBarsViewModel() { _timer.Tick += (sender, args) => { Series1.RemoveAt(0); Series1.Add(_random.Next(-10, 39)); Series2.RemoveAt(0); Series2.Add(_random.Next(-10, 39)); }; }
private async Task <Series2> SetObjects(Series2 s) { try { var genre = await GetGenreById(s.Genre.GenreId); var country = await GetCountryById(s.Country.CountryId); if (genre is null || country is null) { return(null); } s.Country = country; s.Genre = genre; return(s); } catch (Exception) { throw; } }
public async Task <bool> AddSeries(Series2 s) { try { s = await SetObjects(s); if (s is null) { return(false); } await _db.AddAsync(s); await _db.SaveChangesAsync(); return(true); } catch (Exception) { throw; } }