private void OKClick(object sender, RoutedEventArgs e) { Item item; using (Model1 m1 = new Model1()) { item = m1.Items.FirstOrDefault(x => x.Name == ItemName.Content.ToString()); m1.SaveChanges(); } Operations.AddAuction(item, textBoxName.Text); }