private void SaveChanges(object sender, RoutedEventArgs e) { Genre currentgenre = GenreEdit.SelectedItem as Genre; GameCompany currentCompany = CompanyEdit.SelectedItem as GameCompany; var currentcompanyid = localstore.ReturnGameCompanyId(currentCompany.Name); var currentgenreid = localstore.ReturnGenreId(currentgenre.Name); gameforsave.Title = Title.Text; gameforsave.CreatorCompany = currentCompany; gameforsave.CreatorCompanyId = currentcompanyid; gameforsave.Price = float.Parse(Price.Text); gameforsave.Rate = int.Parse(Rating.Value.ToString()); gameforsave.DateCreated = DateCreated.SelectedDate.Value; gameforsave.Genre = currentgenre; gameforsave.GenreId = currentgenreid; gameforsave.Image = null; try { localstore.SaveChanges(); MessageBox.Show("Game edited successfully!"); this.Close(); } catch (Exception exc) { throw exc; } }
public void Save() { _db.SaveChanges(); }