diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c9a181 --- /dev/null +++ b/.gitignore @@ -0,0 +1,242 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +[Xx]64/ +[Xx]86/ +[Bb]uild/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml + +# TODO: Un-comment the next line if you do not want to checkin +# your web deploy settings because they may include unencrypted +# passwords +#*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directory +AppPackages/ +BundleArtifacts/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# LightSwitch generated files +GeneratedArtifacts/ +ModelManifest.xml + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ diff --git a/GeekHunter.sqlite b/GeekHunter.sqlite index 7401c48..48632fc 100644 Binary files a/GeekHunter.sqlite and b/GeekHunter.sqlite differ diff --git a/GeekHunter/GeekHunter.sln b/GeekHunter/GeekHunter.sln new file mode 100644 index 0000000..7fe572f --- /dev/null +++ b/GeekHunter/GeekHunter.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekHunter", "GeekHunter\GeekHunter.csproj", "{7C95021F-60EB-4900-AA34-9C7F720CCABA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestGeekHunter", "UnitTestGeekHunter\UnitTestGeekHunter.csproj", "{2B1A46CA-E2F1-47F1-A94A-D98752C92E50}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekHunterUI", "GeekHunterUI\GeekHunterUI.csproj", "{A13F0EB3-3172-4A19-A4E3-30FD4D89BC63}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7C95021F-60EB-4900-AA34-9C7F720CCABA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C95021F-60EB-4900-AA34-9C7F720CCABA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7C95021F-60EB-4900-AA34-9C7F720CCABA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7C95021F-60EB-4900-AA34-9C7F720CCABA}.Release|Any CPU.Build.0 = Release|Any CPU + {2B1A46CA-E2F1-47F1-A94A-D98752C92E50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B1A46CA-E2F1-47F1-A94A-D98752C92E50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B1A46CA-E2F1-47F1-A94A-D98752C92E50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B1A46CA-E2F1-47F1-A94A-D98752C92E50}.Release|Any CPU.Build.0 = Release|Any CPU + {A13F0EB3-3172-4A19-A4E3-30FD4D89BC63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A13F0EB3-3172-4A19-A4E3-30FD4D89BC63}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A13F0EB3-3172-4A19-A4E3-30FD4D89BC63}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A13F0EB3-3172-4A19-A4E3-30FD4D89BC63}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GeekHunter/GeekHunter/App.config b/GeekHunter/GeekHunter/App.config new file mode 100644 index 0000000..d1428ad --- /dev/null +++ b/GeekHunter/GeekHunter/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/GeekHunter/GeekHunter/Candidate.cs b/GeekHunter/GeekHunter/Candidate.cs new file mode 100644 index 0000000..a202383 --- /dev/null +++ b/GeekHunter/GeekHunter/Candidate.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GeekHunter +{ + public class Candidate + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + + public List SkillIds { get; set; } + public string SkillNames { get; set; } + } + + +} diff --git a/GeekHunter/GeekHunter/DataService.cs b/GeekHunter/GeekHunter/DataService.cs new file mode 100644 index 0000000..5eb316f --- /dev/null +++ b/GeekHunter/GeekHunter/DataService.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GeekHunter +{ + public class DataService + { + private readonly ISQLiteProcessor sqLiteProcessor; + + public DataService(ISQLiteProcessor sqLiteProcessor) + { + this.sqLiteProcessor = sqLiteProcessor; + } + + public IList GetAllCandidates() + { + var candidates = sqLiteProcessor.GetAllCandidates(); + foreach (var candidate in candidates) + { + var skills = sqLiteProcessor.GetCandidateSkills(candidate.Id); + + List ids = skills.Keys.ToList(); + List names = skills.Values.ToList(); + + candidate.SkillNames = string.Join(",", names); + candidate.SkillIds = ids; + } + return candidates; + } + + public IList GetAllSkills() { + return sqLiteProcessor.GetAllSkills(); + } + + public int CreateCandidate(string firstName, string lastName, IList skillIds ) + { + return sqLiteProcessor.CreateCandidateAndSkills(firstName, lastName, skillIds); + } + } +} diff --git a/GeekHunter/GeekHunter/GeekHunter.csproj b/GeekHunter/GeekHunter/GeekHunter.csproj new file mode 100644 index 0000000..5247814 --- /dev/null +++ b/GeekHunter/GeekHunter/GeekHunter.csproj @@ -0,0 +1,73 @@ + + + + + Debug + AnyCPU + {7C95021F-60EB-4900-AA34-9C7F720CCABA} + Exe + Properties + GeekHunter + GeekHunter + v4.5 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + + + ..\..\..\..\..\..\..\Program Files\System.Data.SQLite\2012\bin\System.Data.SQLite.dll + + + ..\..\..\..\..\..\..\Program Files\System.Data.SQLite\2012\bin\System.Data.SQLite.Linq.dll + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GeekHunter/GeekHunter/Program.cs b/GeekHunter/GeekHunter/Program.cs new file mode 100644 index 0000000..f1585a7 --- /dev/null +++ b/GeekHunter/GeekHunter/Program.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Data.SQLite; +using System.Data.SQLite.Linq; + + + +namespace GeekHunter +{ + class Program + { + static void Main(string[] args) { + var path = "GeekHunter.sqlite"; + + var dataService = new DataService(new SQLiteProcessor()); + + IList candidates; + candidates = dataService.GetAllCandidates(); + + IList skills; + skills = dataService.GetAllSkills(); + + foreach (var candidate in candidates) { + Console.WriteLine(candidate.FirstName + " " + candidate.LastName + " " + candidate.SkillNames); + } + + foreach (var skill in skills) { + Console.WriteLine(skill.Id + " " + skill.Name); + } + Console.ReadKey(); + + dataService.CreateCandidate("Jane", "Doe", new List {1, 2, 3}); + } + } +} diff --git a/GeekHunter/GeekHunter/Properties/AssemblyInfo.cs b/GeekHunter/GeekHunter/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..718ea1e --- /dev/null +++ b/GeekHunter/GeekHunter/Properties/AssemblyInfo.cs @@ -0,0 +1,38 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("GeekHunter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GeekHunter")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("7c95021f-60eb-4900-aa34-9c7f720ccaba")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: InternalsVisibleTo("UnitTestGeekHunter")] + diff --git a/GeekHunter/GeekHunter/SQLiteProcessor.cs b/GeekHunter/GeekHunter/SQLiteProcessor.cs new file mode 100644 index 0000000..2b08118 --- /dev/null +++ b/GeekHunter/GeekHunter/SQLiteProcessor.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Data.SQLite; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace GeekHunter +{ + public interface ISQLiteProcessor + { + int CreateCandidateAndSkills(string firstName, string lastName, IList skillIds); + Dictionary GetCandidateSkills(int candidateId); + IList GetAllCandidates(); + IList GetAllSkills(); + } + + public class SQLiteProcessor : ISQLiteProcessor + { + private string sqliteAddress; + + public SQLiteProcessor(string sqliteAddress = @"Data Source=C:\Users\Joe\Documents\GitHub\GeekHunters\GeekHunter.sqlite") + { + this.sqliteAddress = sqliteAddress; + } + + public int CreateCandidateAndSkills(string firstName, string lastName, IList skillIds) + { + var candidateId = GetAllCandidates().Max(c => c.Id) + 1; + CreateCandidate(candidateId, firstName, lastName); + foreach (int skillId in skillIds) + { + CreateCandidateSkills(candidateId, skillId); + + } + return candidateId; + } + + private void ExecuteNonQuery(string query) { + using (SQLiteConnection conn = new SQLiteConnection(sqliteAddress)) { + conn.Open(); + using (SQLiteCommand cmd = new SQLiteCommand(conn)) { + cmd.CommandText = query; + cmd.ExecuteNonQuery(); + } + } + } + + private void CreateCandidate(int id, string firstName, string LastName) + { + var query = $"insert into Candidate(id, firstname, lastname) values({id}, '{firstName}', '{LastName}')"; + + ExecuteNonQuery(query); + } + + private void CreateCandidateSkills(int Candidateid, int SkillId) { + var query = $"insert into CandidateSkill(CandidateId, SkillId) values({Candidateid}, {SkillId})"; + ExecuteNonQuery(query); + } + + + public Dictionary GetCandidateSkills(int candidateId) { + using (SQLiteConnection conn = new SQLiteConnection(sqliteAddress)) { + conn.Open(); + using (SQLiteCommand cmd = new SQLiteCommand(conn)) { + cmd.CommandText = $"select id, name from CandidateSkill join Skill on skill.Id = CandidateSkill.SkillId where CandidateId = {candidateId}"; + using (SQLiteDataReader reader = cmd.ExecuteReader()) { + Dictionary skills = new Dictionary(); + while (reader.Read()) { + var id = reader.GetInt32(0); + var name = reader.GetString(1); + + skills.Add(id, name); + } + return skills; + } + } + } + } + + public IList GetAllCandidates() { + using (SQLiteConnection conn = new SQLiteConnection(sqliteAddress)) + { + conn.Open(); + using (SQLiteCommand cmd = new SQLiteCommand(conn)) + { + cmd.CommandText = "select id, FirstName, LastName from Candidate"; + using (SQLiteDataReader reader = cmd.ExecuteReader()) { + IList candidates = new List(); + while (reader.Read()) { + candidates.Add(new Candidate { Id = reader.GetInt32(0), FirstName = reader.GetString(1), LastName = reader.GetString(2) }); + } + return candidates; + } + } + } + } + + public IList GetAllSkills() { + using (SQLiteConnection conn = new SQLiteConnection(sqliteAddress)) { + conn.Open(); + using (SQLiteCommand cmd = new SQLiteCommand(conn)) { + cmd.CommandText = "select Id, Name from Skill"; + using (SQLiteDataReader reader = cmd.ExecuteReader()) { + IList candidates = new List(); + while (reader.Read()) { + candidates.Add(new Skill { Id = reader.GetInt32(0), Name = reader.GetString(1) }); + } + return candidates; + } + } + } + } + } +} diff --git a/GeekHunter/GeekHunter/Skill.cs b/GeekHunter/GeekHunter/Skill.cs new file mode 100644 index 0000000..16c1fb0 --- /dev/null +++ b/GeekHunter/GeekHunter/Skill.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GeekHunter +{ + public class Skill + { + public int Id { get; set; } + public string Name { get; set; } + + public bool IsSelected { get; set; } + } +} diff --git a/GeekHunter/GeekHunterUI/App.config b/GeekHunter/GeekHunterUI/App.config new file mode 100644 index 0000000..d1428ad --- /dev/null +++ b/GeekHunter/GeekHunterUI/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/GeekHunter/GeekHunterUI/App.xaml b/GeekHunter/GeekHunterUI/App.xaml new file mode 100644 index 0000000..871c4f4 --- /dev/null +++ b/GeekHunter/GeekHunterUI/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/GeekHunter/GeekHunterUI/App.xaml.cs b/GeekHunter/GeekHunterUI/App.xaml.cs new file mode 100644 index 0000000..e72120f --- /dev/null +++ b/GeekHunter/GeekHunterUI/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace GeekHunterUI +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/GeekHunter/GeekHunterUI/GeekHunterUI.csproj b/GeekHunter/GeekHunterUI/GeekHunterUI.csproj new file mode 100644 index 0000000..d4b7689 --- /dev/null +++ b/GeekHunter/GeekHunterUI/GeekHunterUI.csproj @@ -0,0 +1,115 @@ + + + + + Debug + AnyCPU + {A13F0EB3-3172-4A19-A4E3-30FD4D89BC63} + WinExe + Properties + GeekHunterUI + GeekHunterUI + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + {7C95021F-60EB-4900-AA34-9C7F720CCABA} + GeekHunter + + + + + \ No newline at end of file diff --git a/GeekHunter/GeekHunterUI/MainViewModel.cs b/GeekHunter/GeekHunterUI/MainViewModel.cs new file mode 100644 index 0000000..66e3683 --- /dev/null +++ b/GeekHunter/GeekHunterUI/MainViewModel.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using GeekHunter; + +namespace GeekHunterUI +{ + public class MainViewModel + { + private DataService dataServivce; + + public MainViewModel() + { + dataServivce = new DataService(new SQLiteProcessor()); + Skills = new ObservableCollection(); + Candidates = new ObservableCollection(); + dataServivce.GetAllSkills().ToList().ForEach(skill => Skills.Add(skill)); + + ReloadAllCandidates(); + } + public ObservableCollection Skills { get; private set; } + + internal void AddCandidate(string firstName, string lastName, List skillIds) + { + dataServivce.CreateCandidate(firstName, lastName, skillIds); + + Candidates.Clear(); + ReloadAllCandidates(); + } + + public ObservableCollection Candidates { get; private set; } + + public void SearchCandidate(List skillIds) + { + var searchResult = Candidates.Where(candidate => + { + return skillIds.All(requiredSkill => candidate.SkillIds.Contains(requiredSkill)); + }).ToList(); + + Candidates.Clear(); + + searchResult.ToList().ForEach(candidate => Candidates.Add(candidate)); + } + + public void ReloadAllCandidates() + { + Candidates.Clear(); + dataServivce.GetAllCandidates().ToList().ForEach(candidate => Candidates.Add(candidate)); + } + } +} diff --git a/GeekHunter/GeekHunterUI/MainWindow.xaml b/GeekHunter/GeekHunterUI/MainWindow.xaml new file mode 100644 index 0000000..5fecada --- /dev/null +++ b/GeekHunter/GeekHunterUI/MainWindow.xaml @@ -0,0 +1,50 @@ + + + + + +