private void btnSave_Click(object sender, RoutedEventArgs e) { Rol rol = new Rol(); DataContext context = new DataContext(); RolRepository rolRepository = new RolRepository(context); UserWindow window = new UserWindow(); string name, details; name = tbName.Text; details = tbDetail.Text; if (!rolRepository.Exist(rolRepository.ObtainId(name))) { rol.Name = name; rol.Details = details; rolRepository.Create(rol); MessageBox.Show("Rol Created! " + name); window.RefreshComboBox(); RefreshGrid(); } else { MessageBox.Show("Rol exist, change the name."); } }