//load data array from "Directions" table public void LoadDirectionsData() { using (StudentuConteiner db = new StudentuConteiner()) { try { var list = db.Directions.ToList <Direction>(); foreach (var item in list) { DirRecords.Add( new Direction { DirectionId = item.DirectionId, DirectionName = item.DirectionName }); } Dir = DirRecords[0]; SelectedDir2 = Dir; } catch (ArgumentNullException ex) { dialogService.ShowMessage(ex.Message); } catch (OverflowException ex) { dialogService.ShowMessage(ex.Message); } catch (System.Data.SqlClient.SqlException ex) { dialogService.ShowMessage(ex.Message); } catch (System.Data.Entity.Core.EntityCommandExecutionException ex) { dialogService.ShowMessage(ex.Message); } catch (System.Data.Entity.Core.EntityException ex) { dialogService.ShowMessage(ex.Message); } } }