Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
/MVC.Data/bin/Release
/MVC/bin/MVC.Tutorial.dll
/MVC/bin/MVC.Tutorial.pdb
/Libraries/Sitecore.Kernel.dll
/Libraries/Sitecore.Mvc.dll
/Libraries/*.dll
/MVC/bin/Castle.Core.dll
/MVC/bin/Castle.Core.xml
/MVC/bin/Castle.Windsor.dll
Expand All @@ -39,3 +38,14 @@
/MVC/bin/Sitecore.Mvc.dll
/packages
/MVC.Data/bin/Debug/MVC.Data.dll
obj/
/build
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
*.vssscc
$tf*/
/packages
/Images
/Website/Local Disk
*$recycle.bin*
6 changes: 6 additions & 0 deletions .nuget/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Binary file added .nuget/NuGet.exe
Binary file not shown.
144 changes: 144 additions & 0 deletions .nuget/NuGet.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>

<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>

<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>

<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>

<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
</PropertyGroup>

<PropertyGroup>
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
</PropertyGroup>

<PropertyGroup>
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
</PropertyGroup>

<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>

<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>

<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>

<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>

<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
14 changes: 14 additions & 0 deletions MVC.Data/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MVC.Data
{
public static class Constants
{
public static readonly string SitecoreWebIndexName = "sitecore_web_index";
public static readonly string SitecoreHomePath = "/sitecore/content/Home";
}
}
27 changes: 27 additions & 0 deletions MVC.Data/MVC.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,29 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Sitecore.Buckets">
<HintPath>..\Libraries\Sitecore.Buckets.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.ContentSearch">
<HintPath>..\Libraries\Sitecore.ContentSearch.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.ContentSearch.Linq">
<HintPath>..\Libraries\Sitecore.ContentSearch.Linq.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.Kernel">
<HintPath>..\Libraries\Sitecore.Kernel.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.Mvc">
<HintPath>..\Libraries\Sitecore.Mvc.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
Expand All @@ -47,6 +63,13 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Constants.cs" />
<Compile Include="Models\CustomerContact.cs" />
<Compile Include="Models\CustomerDetails.cs" />
<Compile Include="Models\CustomSearchResult.cs" />
<Compile Include="Models\Facet.cs" />
<Compile Include="Models\FacetValue.cs" />
<Compile Include="Models\Search.cs" />
<Compile Include="References.cs" />
<Compile Include="Domain\ILocationDomain.cs" />
<Compile Include="Domain\LocationDomain.cs" />
Expand All @@ -59,8 +82,12 @@
<Compile Include="Repositories\IDriverRepository.cs" />
<Compile Include="Repositories\ISitecoreRepository.cs" />
<Compile Include="Repositories\SitecoreRepository.cs" />
<Compile Include="Services\ISearchService.cs" />
<Compile Include="Services\SearchService.cs" />
<Compile Include="ViewModels\DriverViewModel.cs" />
<Compile Include="ViewModels\LocationViewModel.cs" />
<Compile Include="ViewModels\RegisterViewModel.cs" />
<Compile Include="ViewModels\SearchResultViewModel.cs" />
<Compile Include="Wrappers\IItem.cs" />
<Compile Include="Wrappers\IRenderingWrapper.cs" />
<Compile Include="Wrappers\RenderingWrapper.cs" />
Expand Down
15 changes: 15 additions & 0 deletions MVC.Data/Models/CustomSearchResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.SearchTypes;

namespace MVC.Data.Models
{
public class CustomSearchResult : SearchResultItem
{
[IndexField("Content")]
public string PageStuff { get; set; }

[IndexField("_highlightedSearch")]
public string HighlightedSearch { get; set; }

}
}
31 changes: 31 additions & 0 deletions MVC.Data/Models/CustomerContact.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.ComponentModel.DataAnnotations;

namespace MVC.Data.Models
{
public class CustomerContact
{
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 3)]
[Display(Name = "First name")]
public string FirstName { get; set; }

[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 3)]
[Display(Name = "User name")]
public string LastName { get; set; }

[Display(Name = "Email address")]
[Required(ErrorMessage = "The email address is required")]
[EmailAddress(ErrorMessage = "Invalid Email Address Format")]
public string EmailAddress { get; set; }

[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string Password { get; set; }

[Compare("Password", ErrorMessage = "Passwords must match")]
public string ConfirmationPassword { get; set; }
}
}
22 changes: 22 additions & 0 deletions MVC.Data/Models/CustomerDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;

namespace MVC.Data.Models
{
public class CustomerDetails
{
[Required]
[Range(0, 200, ErrorMessage = "Please enter valid age")]
[Display(Name = "Age")]
public int Age { get; set; }

[Required]
[StringLength(100, ErrorMessage = "Please enter Male or Female", MinimumLength = 3)]
[Display(Name = "Sex")]
public string Sex { get; set; }

[Required]
[StringLength(100, ErrorMessage = "Please enter valid location", MinimumLength = 3)]
[Display(Name = "Place of Birth")]
public string PlaceOfBirth { get; set; }
}
}
22 changes: 22 additions & 0 deletions MVC.Data/Models/Facet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MVC.Data.Models
{
public class Facet
{
public Facet(string key, string name)
{
Key = key;
Name = name;
Values = new List<FacetValue>();
}

public string Key { get; set; }
public string Name { get; set; }
public List<FacetValue> Values { get; set; }
}
}
22 changes: 22 additions & 0 deletions MVC.Data/Models/FacetValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MVC.Data.Models
{
public class FacetValue
{
public FacetValue(string facetName, string facetTemplateId, int facetCount)
{
Name = facetName;
TemplateId = facetTemplateId;
Count = facetCount;
}

public string Name { get; set; }
public string TemplateId { get; set; }
public int Count { get; set; }
}
}
14 changes: 14 additions & 0 deletions MVC.Data/Models/Search.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MVC.Data.Models
{
public class Search
{
public string SearchTerm { get; set; }
public string SearchPage { get; set; }
}
}
9 changes: 9 additions & 0 deletions MVC.Data/Services/ISearchService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using MVC.Data.ViewModels;

namespace MVC.Data.Services
{
public interface ISearchService
{
SearchResultViewModel FieldSearch(string searchTerm, int startIndex, int pageSize);
}
}
Loading