diff --git a/Tests/Properties/AssemblyInfo.cs b/Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index d6e6f8c..0000000
--- a/Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Tests")]
-[assembly: AssemblyCopyright("Copyright © 2019")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("ddc86d49-c599-4782-b3e4-d66167bac90f")]
-
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
deleted file mode 100644
index ce0f36a..0000000
--- a/Tests/Tests.csproj
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Debug
- AnyCPU
- {DDC86D49-C599-4782-B3E4-D66167BAC90F}
- Library
- Properties
- Tests
- Tests
- v4.7.2
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll
-
-
- ..\packages\Microsoft.AspNetCore.Antiforgery.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Antiforgery.dll
-
-
- ..\packages\Microsoft.AspNetCore.Authentication.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Authentication.Core.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Core.dll
-
-
- ..\packages\Microsoft.AspNetCore.Authorization.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authorization.dll
-
-
- ..\packages\Microsoft.AspNetCore.Authorization.Policy.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authorization.Policy.dll
-
-
- ..\packages\Microsoft.AspNetCore.Cors.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Cors.dll
-
-
- ..\packages\Microsoft.AspNetCore.Cryptography.Internal.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Cryptography.Internal.dll
-
-
- ..\packages\Microsoft.AspNetCore.DataProtection.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.DataProtection.dll
-
-
- ..\packages\Microsoft.AspNetCore.DataProtection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.DataProtection.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Diagnostics.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Diagnostics.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Hosting.Server.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Server.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Html.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Html.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Http.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.dll
-
-
- ..\packages\Microsoft.AspNetCore.Http.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Http.Extensions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Extensions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Http.Features.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll
-
-
- ..\packages\Microsoft.AspNetCore.JsonPatch.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.JsonPatch.dll
-
-
- ..\packages\Microsoft.AspNetCore.Localization.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Localization.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.ApiExplorer.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.ApiExplorer.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.Core.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.Cors.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Cors.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.DataAnnotations.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.DataAnnotations.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.Formatters.Json.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Formatters.Json.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.Localization.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Localization.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.Razor.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.Razor.Extensions.2.2.0\lib\net46\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.RazorPages.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.RazorPages.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.TagHelpers.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.TagHelpers.dll
-
-
- ..\packages\Microsoft.AspNetCore.Mvc.ViewFeatures.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.ViewFeatures.dll
-
-
- ..\packages\Microsoft.AspNetCore.Razor.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Razor.dll
-
-
- ..\packages\Microsoft.AspNetCore.Razor.Language.3.1.0-preview2.19528.1\lib\netstandard2.0\Microsoft.AspNetCore.Razor.Language.dll
-
-
- ..\packages\Microsoft.AspNetCore.Razor.Runtime.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Razor.Runtime.dll
-
-
- ..\packages\Microsoft.AspNetCore.ResponseCaching.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.ResponseCaching.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.Routing.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Routing.dll
-
-
- ..\packages\Microsoft.AspNetCore.Routing.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Routing.Abstractions.dll
-
-
- ..\packages\Microsoft.AspNetCore.WebUtilities.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll
-
-
- ..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0-preview2.19523.17\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
-
-
- ..\packages\Microsoft.CodeAnalysis.Common.3.4.0-beta2-final\lib\netstandard2.0\Microsoft.CodeAnalysis.dll
-
-
- ..\packages\Microsoft.CodeAnalysis.CSharp.3.4.0-beta2-final\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.dll
-
-
- ..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.3.4.0-beta2-final\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.Workspaces.dll
-
-
- ..\packages\Microsoft.CodeAnalysis.Razor.3.1.0-preview2.19528.1\lib\netstandard2.0\Microsoft.CodeAnalysis.Razor.dll
-
-
- ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.3.4.0-beta2-final\lib\netstandard2.0\Microsoft.CodeAnalysis.Workspaces.dll
-
-
-
- ..\packages\Microsoft.DotNet.PlatformAbstractions.2.1.0\lib\net45\Microsoft.DotNet.PlatformAbstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Caching.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Caching.Memory.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll
-
-
- ..\packages\Microsoft.Extensions.Configuration.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.DependencyInjection.3.1.0-preview2.19525.4\lib\net461\Microsoft.Extensions.DependencyInjection.dll
-
-
- ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.3.1.0-preview2.19525.4\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.dll
-
-
- ..\packages\Microsoft.Extensions.FileProviders.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.FileProviders.Composite.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Composite.dll
-
-
- ..\packages\Microsoft.Extensions.FileSystemGlobbing.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileSystemGlobbing.dll
-
-
- ..\packages\Microsoft.Extensions.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Localization.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Localization.dll
-
-
- ..\packages\Microsoft.Extensions.Localization.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Localization.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Logging.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.ObjectPool.2.2.0\lib\netstandard2.0\Microsoft.Extensions.ObjectPool.dll
-
-
- ..\packages\Microsoft.Extensions.Options.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll
-
-
- ..\packages\Microsoft.Extensions.Primitives.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll
-
-
- ..\packages\Microsoft.Extensions.WebEncoders.2.2.0\lib\netstandard2.0\Microsoft.Extensions.WebEncoders.dll
-
-
- ..\packages\Microsoft.Net.Http.Headers.2.2.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll
-
-
- ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
-
-
- ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
-
-
- ..\packages\Microsoft.VisualStudio.Web.CodeGeneration.3.1.0-preview2.19553.1\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.dll
-
-
- ..\packages\Microsoft.VisualStudio.Web.CodeGeneration.Contracts.3.1.0-preview2.19553.1\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Contracts.dll
-
-
- ..\packages\Microsoft.VisualStudio.Web.CodeGeneration.Core.3.1.0-preview2.19553.1\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Core.dll
-
-
- ..\packages\Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.3.1.0-preview2.19553.1\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.dll
-
-
- ..\packages\Microsoft.VisualStudio.Web.CodeGeneration.Templating.3.1.0-preview2.19553.1\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Templating.dll
-
-
- ..\packages\Microsoft.VisualStudio.Web.CodeGeneration.Utils.3.1.0-preview2.19553.1\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Utils.dll
-
-
- ..\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.3.1.0-preview2.19553.1\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll
-
-
- ..\packages\Microsoft.Win32.Registry.4.5.0\lib\net461\Microsoft.Win32.Registry.dll
-
-
- ..\packages\Moq.4.13.1\lib\net45\Moq.dll
-
-
- ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\Newtonsoft.Json.Bson.1.0.1\lib\net45\Newtonsoft.Json.Bson.dll
-
-
- ..\packages\NuGet.Frameworks.4.7.0\lib\net46\NuGet.Frameworks.dll
-
-
-
- ..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll
- True
- True
-
-
- ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll
-
-
- ..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll
-
-
- ..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll
-
-
-
-
- ..\packages\System.Composition.AttributedModel.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll
-
-
- ..\packages\System.Composition.Convention.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll
-
-
- ..\packages\System.Composition.Hosting.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll
-
-
- ..\packages\System.Composition.Runtime.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll
-
-
- ..\packages\System.Composition.TypedParts.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll
-
-
-
- ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll
- True
- True
-
-
-
-
-
- ..\packages\System.Diagnostics.DiagnosticSource.4.5.0\lib\net46\System.Diagnostics.DiagnosticSource.dll
-
-
- ..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll
- True
- True
-
-
- ..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll
- True
- True
-
-
-
- ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll
- True
- True
-
-
- ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll
- True
- True
-
-
- ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll
- True
- True
-
-
- ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll
- True
- True
-
-
- ..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll
- True
- True
-
-
- ..\packages\System.Linq.Expressions.4.3.0\lib\net463\System.Linq.Expressions.dll
- True
- True
-
-
- ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll
-
-
-
-
- ..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll
-
-
- ..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll
- True
- True
-
-
- ..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll
-
-
- ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll
- True
- True
-
-
- ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
-
-
- ..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll
- True
- True
-
-
- ..\packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll
- True
- True
-
-
- ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll
- True
- True
-
-
-
- ..\packages\System.Security.AccessControl.4.5.0\lib\net461\System.Security.AccessControl.dll
-
-
- ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll
- True
- True
-
-
- ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll
- True
- True
-
-
- ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll
- True
- True
-
-
- ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll
- True
- True
-
-
- ..\packages\System.Security.Cryptography.Xml.4.5.0\lib\net461\System.Security.Cryptography.Xml.dll
-
-
- ..\packages\System.Security.Permissions.4.5.0\lib\net461\System.Security.Permissions.dll
-
-
- ..\packages\System.Security.Principal.Windows.4.5.0\lib\net461\System.Security.Principal.Windows.dll
-
-
-
- ..\packages\System.Text.Encoding.CodePages.4.5.1\lib\net461\System.Text.Encoding.CodePages.dll
-
-
- ..\packages\System.Text.Encodings.Web.4.5.0\lib\netstandard2.0\System.Text.Encodings.Web.dll
-
-
- ..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll
-
-
- ..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll
- True
- True
-
-
-
- ..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll
- True
- True
-
-
-
-
- ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll
- True
- True
-
-
- ..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll
- True
- True
-
-
- ..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll
- True
- True
-
-
- ..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll
- True
- True
-
-
- ..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll
-
-
- ..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll
-
-
- ..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll
-
-
- ..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {edec0e39-cc42-426b-8773-f9356ba20df9}
- uthTrip.BLL
-
-
- {f78c2ccb-0aa4-48f9-8dc1-9f65a5135e05}
- uthTrip.DAL
-
-
- {32e72533-0bdc-440a-9540-af7783555306}
- uthTripProject
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Tests/UnitTest1.cs b/Tests/UnitTest1.cs
deleted file mode 100644
index 7c33807..0000000
--- a/Tests/UnitTest1.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.Linq;
-//using Microsoft.AspNetCore.Mvc;
-using uthTrip.BLL.Services;
-using uthTrip.DAL.Interfaces;
-using uthTrip.BLL.Interfaces;
-using Moq;
-using Xunit;
-using uthTripProject.Controllers;
-using System.Web;
-namespace Tests
-{
-
- public class UnitTest1
- {
- [Fact]
- public void Index_View_Result()
- {
- // Setup
- var expectedUserAccountCount = 2;
-
- var mockUserAccountService = new Mock();
-
- mockUserAccountService.Setup(x => x.GetAll())
- .Returns(GetTestUserAccounts());
-
- // Inject
- var homeController = new UserController(mockUserAccountService.Object);
-
- // Act
- var result = homeController.Index();
-
- // Assert
- var viewResult = Assert.IsType(result);
-
- var model = Assert.IsAssignableFrom>(
- viewResult.ViewData.Model);
-
- Assert.Equal(expectedUserAccountCount, model.Count());
- }
-
- }
-}
diff --git a/Tests/app.config b/Tests/app.config
deleted file mode 100644
index 9ccae07..0000000
--- a/Tests/app.config
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Tests/packages.config b/Tests/packages.config
deleted file mode 100644
index 4a68283..0000000
--- a/Tests/packages.config
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/UnitTestProject1/Properties/AssemblyInfo.cs b/UnitTestProject1/Properties/AssemblyInfo.cs
deleted file mode 100644
index 5780228..0000000
--- a/UnitTestProject1/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("UnitTestProject1")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UnitTestProject1")]
-[assembly: AssemblyCopyright("Copyright © 2019")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("8b8d5cc4-86f5-4793-89eb-296325ca02f9")]
-
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/UnitTestProject1/UnitTest1.cs b/UnitTestProject1/UnitTest1.cs
deleted file mode 100644
index 6270481..0000000
--- a/UnitTestProject1/UnitTest1.cs
+++ /dev/null
@@ -1,212 +0,0 @@
-namespace UnitTestProject1
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.InMemory;
- using Moq;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Services;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Repositories;
- using Xunit;
-
- public class UnitTest1 : IDisposable
- {
- public void Dispose()
- {
- var options = new DbContextOptionsBuilder()
- .UseInMemoryDatabase(databaseName: "UserDatabase").Options;
-
- var context = new UthTripContext(options);
- context.Users.RemoveRange(context.Users);
- context.SaveChanges();
- }
-
- [Fact]
- public void TestCreateUserMethod()
- {
- var options = new DbContextOptionsBuilder()
- .UseInMemoryDatabase(databaseName: "UserDatabase").Options;
- var userService = this.CreateUserService();
-
- userService.CreateUser(new UserDTO
- {
- User_ID = 132,
- First_Name = "Yaroslav",
- Last_Name = "Nolkuchak",
- Username = "user2",
- Email = "simonnolkuchak@com",
- Password = "1178",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "another boy",
- });
- userService.CreateUser(new UserDTO
- {
- User_ID = 123,
- First_Name = "Simon",
- Last_Name = "Gilbert",
- Username = "simongilbert",
- Email = "simongilbert@com",
- Password = "1111",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "some boy",
- });
- // Use a clean instance of the context to run the test
- int res = userService.GetAll().Count();
-
- Assert.Equal(2, res);
- }
-
- [Fact]
- public void TestDeleteUserMethod()
- {
- var options = new DbContextOptionsBuilder()
- .UseInMemoryDatabase(databaseName: "UsersDatabase").Options;
- ////var userService = new UserService(unitOfWork.Object);
- var userService = this.CreateUserService();
-
- userService.CreateUser(new UserDTO
- {
- User_ID = 132,
- First_Name = "Yaroslav",
- Last_Name = "Nolkuchak",
- Username = "user2",
- Email = "simonnolkuchak@com",
- Password = "1178",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "another boy",
- });
- userService.CreateUser(new UserDTO
- {
- User_ID = 123,
- First_Name = "Simon",
- Last_Name = "Gilbert",
- Username = "simongilbert",
- Email = "simongilbert@com",
- Password = "1111",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "some boy",
- });
- userService.Dispose(123);
- int res = userService.GetAll().Count();
-
- Assert.Equal(1, res);
- }
-
- [Fact]
- public void TestGetByID()
- {
- var userService = this.CreateUserService();
- userService.CreateUser(new UserDTO
- {
- User_ID = 132,
- First_Name = "Yaroslav",
- Last_Name = "Nolkuchak",
- Username = "user2",
- Email = "simonnolkuchak@com",
- Password = "1178",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "another boy",
- });
- userService.CreateUser(new UserDTO
- {
- User_ID = 123,
- First_Name = "Simon",
- Last_Name = "Gilbert",
- Username = "simongilbert",
- Email = "simongilbert@com",
- Password = "1111",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "some boy",
- });
-
- var user = userService.GetAll().FirstOrDefault();
- Assert.NotNull(userService.GetById(user.User_ID));
- }
-
- [Fact]
- public void TestGetUserName_Password()
- {
- var userService = this.CreateUserService();
- userService.CreateUser(new UserDTO
- {
- User_ID = 132,
- First_Name = "Yaroslav",
- Last_Name = "Nolkuchak",
- Username = "user2",
- Email = "simonnolkuchak@com",
- Password = "1178",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "another boy",
- });
- userService.CreateUser(new UserDTO
- {
- User_ID = 123,
- First_Name = "Simon",
- Last_Name = "Gilbert",
- Username = "simongilbert",
- Email = "simongilbert@com",
- Password = "1111",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "some boy",
- });
-
- var user = userService.GetAll().FirstOrDefault();
- Assert.NotNull(userService.GetByUsernamePassword("simongilbert", "1111"));
- }
-
- [Fact]
- public void TestFindMax_Id()
- {
- var userService = this.CreateUserService();
- userService.CreateUser(new UserDTO
- {
- User_ID = 132,
- First_Name = "Yaroslav",
- Last_Name = "Nolkuchak",
- Username = "user2",
- Email = "simonnolkuchak@com",
- Password = "1178",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "another boy",
- });
- userService.CreateUser(new UserDTO
- {
- User_ID = 123,
- First_Name = "Simon",
- Last_Name = "Gilbert",
- Username = "simongilbert",
- Email = "simongilbert@com",
- Password = "1111",
- Birthday = DateTime.Now,
- Photo_Url = "www",
- Info = "some boy",
- });
-
- var user = userService.GetAll().FirstOrDefault();
- Assert.Equal(132, userService.FindMaxId());
- }
-
- private UserService CreateUserService()
- {
- var options = new DbContextOptionsBuilder()
- .UseInMemoryDatabase(databaseName: "UserDatabase").Options;
- return new UserService(
- new EFUnitOfWork(
- new UthTripContext(options)));
- }
- }
-}
\ No newline at end of file
diff --git a/UnitTestProject1/UnitTestProject1.csproj b/UnitTestProject1/UnitTestProject1.csproj
deleted file mode 100644
index 15b5172..0000000
--- a/UnitTestProject1/UnitTestProject1.csproj
+++ /dev/null
@@ -1,196 +0,0 @@
-
-
-
-
-
-
-
- Debug
- AnyCPU
- {8B8D5CC4-86F5-4793-89EB-296325CA02F9}
- Library
- Properties
- UnitTestProject1
- UnitTestProject1
- v4.6.1
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll
-
-
- ..\packages\EntityFramework.6.4.0-preview3-19553-01\lib\net45\EntityFramework.dll
-
-
- ..\packages\EntityFramework.6.4.0-preview3-19553-01\lib\net45\EntityFramework.SqlServer.dll
-
-
- ..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0-preview3.19551.4\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
-
-
- ..\packages\Microsoft.Bcl.HashCode.1.1.0-preview3.19551.4\lib\net461\Microsoft.Bcl.HashCode.dll
-
-
- ..\packages\Microsoft.EntityFrameworkCore.3.1.0-preview3.19554.8\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll
-
-
- ..\packages\Microsoft.EntityFrameworkCore.Abstractions.3.1.0-preview3.19554.8\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Abstractions.dll
-
-
- ..\packages\Microsoft.EntityFrameworkCore.InMemory.3.1.0-preview3.19554.8\lib\netstandard2.0\Microsoft.EntityFrameworkCore.InMemory.dll
-
-
- ..\packages\Microsoft.Extensions.Caching.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Caching.Memory.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll
-
-
- ..\packages\Microsoft.Extensions.Configuration.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll
-
-
- ..\packages\Microsoft.Extensions.Configuration.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Configuration.Binder.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll
-
-
- ..\packages\Microsoft.Extensions.DependencyInjection.3.1.0-preview3.19553.2\lib\net461\Microsoft.Extensions.DependencyInjection.dll
-
-
- ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Logging.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Logging.dll
-
-
- ..\packages\Microsoft.Extensions.Logging.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Options.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Options.dll
-
-
- ..\packages\Microsoft.Extensions.Primitives.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll
-
-
- ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
-
-
- ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
-
-
- ..\packages\Moq.4.13.1\lib\net45\Moq.dll
-
-
-
- ..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll
-
-
- ..\packages\System.Collections.Immutable.1.7.0-preview3.19551.4\lib\netstandard2.0\System.Collections.Immutable.dll
-
-
- ..\packages\System.ComponentModel.Annotations.4.7.0-preview3.19551.4\lib\net461\System.ComponentModel.Annotations.dll
-
-
-
-
-
- ..\packages\System.Diagnostics.DiagnosticSource.4.7.0-preview3.19551.4\lib\net46\System.Diagnostics.DiagnosticSource.dll
-
-
- ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll
-
-
-
- ..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll
-
-
- ..\packages\System.Runtime.CompilerServices.Unsafe.4.7.0-preview3.19551.4\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
-
-
- ..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll
-
-
- ..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll
-
-
- ..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll
-
-
- ..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll
-
-
- ..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {edec0e39-cc42-426b-8773-f9356ba20df9}
- uthTrip.BLL
-
-
- {f78c2ccb-0aa4-48f9-8dc1-9f65a5135e05}
- uthTrip.DAL
-
-
- {32e72533-0bdc-440a-9540-af7783555306}
- UthTripProject
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/UnitTestProject1/app.config b/UnitTestProject1/app.config
index bbc3542..37a0dc9 100644
--- a/UnitTestProject1/app.config
+++ b/UnitTestProject1/app.config
@@ -54,6 +54,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -61,4 +101,4 @@
-
+
\ No newline at end of file
diff --git a/UnitTestProject1/packages.config b/UnitTestProject1/packages.config
deleted file mode 100644
index adc88d6..0000000
--- a/UnitTestProject1/packages.config
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/UnitTests/Properties/AssemblyInfo.cs b/UnitTests/Properties/AssemblyInfo.cs
deleted file mode 100644
index bffcdc5..0000000
--- a/UnitTests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("UnitTests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UnitTests")]
-[assembly: AssemblyCopyright("Copyright © 2019")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("4a5a0491-90e9-42ef-9f0d-cf980a763af7")]
-
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/UnitTests/UnitTest1.cs b/UnitTests/UnitTest1.cs
deleted file mode 100644
index 1368e4e..0000000
--- a/UnitTests/UnitTest1.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//using System;
-//using Microsoft.VisualStudio.TestTools.UnitTesting;
-//using System.Web.Mvc;
-//using Moq;
-//namespace UnitTests
-//{
-// [TestClass]
-// public class UnitTest1
-// {
-// [TestMethod]
-// public void Sum_Products_Correctly()
-// {
-// // Arrange (добавляем имитированный объект)
-// Mock mock = new Mock();
-// mock.Setup(m => m.GetAll());
-
-// UserController controller = new UserController(mock.Object);
-// string expected = "В базе данных 1 объект";
-
-// // Act
-// controller.Index();
-// ViewResult result = controller.Index() as ViewResult;
-// string actual = result.ViewBag.Message as string;
-
-// // Assert
-// Assert.AreEqual(expected, actual);
-// }
-// }
-//}
diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj
deleted file mode 100644
index 259885b..0000000
--- a/UnitTests/UnitTests.csproj
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
- Debug
- AnyCPU
- {4A5A0491-90E9-42EF-9F0D-CF980A763AF7}
- Library
- Properties
- UnitTests
- UnitTests
- v4.7.2
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll
-
-
- ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
-
-
- ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
-
-
- ..\packages\Moq.4.13.1\lib\net45\Moq.dll
-
-
-
-
-
- ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
-
-
- ..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll
-
-
- ..\packages\System.Web.Mvc.Extensions.1.1.1.2\lib\net45\System.Web.Mvc.Extensions.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/UnitTests/packages.config b/UnitTests/packages.config
deleted file mode 100644
index ac38aa6..0000000
--- a/UnitTests/packages.config
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/user.css b/user.css
deleted file mode 100644
index 0e36810..0000000
--- a/user.css
+++ /dev/null
@@ -1,3 +0,0 @@
-body
-{
-}
\ No newline at end of file
diff --git a/uthTrip.BLL/App.config b/uthTrip.BLL/App.config
index 21d33da..2c06cb9 100644
--- a/uthTrip.BLL/App.config
+++ b/uthTrip.BLL/App.config
@@ -1,6 +1,8 @@
+<<<<<<< Updated upstream
+=======
@@ -29,7 +31,224 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>>>>>>> Stashed changes
\ No newline at end of file
diff --git a/uthTrip.BLL/DTO/BlockedUsersDTO.cs b/uthTrip.BLL/DTO/BlockedUsersDTO.cs
index b5134b7..cdbd1ed 100644
--- a/uthTrip.BLL/DTO/BlockedUsersDTO.cs
+++ b/uthTrip.BLL/DTO/BlockedUsersDTO.cs
@@ -1,31 +1,14 @@
-namespace UthTrip.BLL.DTO
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
- public class BlockedUsersDTO
+namespace uthTrip.BLL.DTO
+{
+ class BlockedUsersDTO
{
- public BlockedUsersDTO()
- {
-
- }
-
- public BlockedUsersDTO(int blocked_ID, int? user_ID)
- {
- Blocked_ID = blocked_ID;
- User_ID = user_ID;
- }
-
- public BlockedUsersDTO(int? user_ID)
- {
- User_ID = user_ID;
- }
-
public int Blocked_ID { get; set; }
-
public int? User_ID { get; set; }
}
}
diff --git a/uthTrip.BLL/DTO/DatesRangeDTO.cs b/uthTrip.BLL/DTO/DatesRangeDTO.cs
index f3f096e..2a47272 100644
--- a/uthTrip.BLL/DTO/DatesRangeDTO.cs
+++ b/uthTrip.BLL/DTO/DatesRangeDTO.cs
@@ -1,28 +1,25 @@
-namespace UthTrip.BLL.DTO
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+namespace uthTrip.BLL.DTO
+{
public class DatesRangeDTO
{
+ public int Date_ID { get; set; }
+ public DateTime? Start_date { get; set; }
+ public DateTime? End_date { get; set; }
public DatesRangeDTO()
{
- }
+ }
public DatesRangeDTO(int date_ID, DateTime? start_date, DateTime? end_date)
{
- this.Date_ID = date_ID;
- this.Start_date = start_date;
- this.End_date = end_date;
+ Date_ID = date_ID;
+ Start_date = start_date;
+ End_date = end_date;
}
-
- public int Date_ID { get; set; }
-
- public DateTime? Start_date { get; set; }
-
- public DateTime? End_date { get; set; }
}
}
diff --git a/uthTrip.BLL/DTO/DestinationDTO.cs b/uthTrip.BLL/DTO/DestinationDTO.cs
index 0e65b18..20ecfda 100644
--- a/uthTrip.BLL/DTO/DestinationDTO.cs
+++ b/uthTrip.BLL/DTO/DestinationDTO.cs
@@ -1,31 +1,27 @@
-namespace UthTrip.BLL.DTO
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+namespace uthTrip.BLL.DTO
+{
public class DestinationDTO
{
+ public int Destination_ID { get; set; }
+ public bool Is_Abroad { get; set; }
+ public string Country { get; set; }
+ public string City { get; set; }
public DestinationDTO()
{
- }
+ }
public DestinationDTO(int destination_ID, bool is_Abroad, string country, string city)
{
- this.Destination_ID = destination_ID;
- this.Is_Abroad = is_Abroad;
- this.Country = country;
- this.City = city;
+ Destination_ID = destination_ID;
+ Is_Abroad = is_Abroad;
+ Country = country;
+ City = city;
}
-
- public int Destination_ID { get; set; }
-
- public bool Is_Abroad { get; set; }
-
- public string Country { get; set; }
-
- public string City { get; set; }
}
}
diff --git a/uthTrip.BLL/DTO/ReviewDTO.cs b/uthTrip.BLL/DTO/ReviewDTO.cs
index ddb6048..05f8804 100644
--- a/uthTrip.BLL/DTO/ReviewDTO.cs
+++ b/uthTrip.BLL/DTO/ReviewDTO.cs
@@ -1,30 +1,17 @@
-namespace UthTrip.BLL.DTO
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
- public class ReviewDTO
+namespace uthTrip.BLL.DTO
+{
+ class ReviewDTO
{
- public ReviewDTO(int review_ID, int writer_ID, int trip_ID, string review1, int? mark)
- {
- Review_ID = review_ID;
- Writer_ID = writer_ID;
- Trip_ID = trip_ID;
- Review1 = review1;
- Mark = mark;
- }
-
public int Review_ID { get; set; }
-
public int Writer_ID { get; set; }
-
public int Trip_ID { get; set; }
-
public string Review1 { get; set; }
-
public int? Mark { get; set; }
}
}
diff --git a/uthTrip.BLL/DTO/RightDTO.cs b/uthTrip.BLL/DTO/RightDTO.cs
index 9007976..928e1e1 100644
--- a/uthTrip.BLL/DTO/RightDTO.cs
+++ b/uthTrip.BLL/DTO/RightDTO.cs
@@ -1,31 +1,16 @@
-namespace UthTrip.BLL.DTO
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
- public class RightDTO
+namespace uthTrip.BLL.DTO
+{
+ class RightDTO
{
public int Rights_ID { get; set; }
-
public int User_ID { get; set; }
-
public int Role_ID { get; set; }
-
public int Trip_ID { get; set; }
-
- public RightDTO()
- {
- }
-
- public RightDTO(int rights_ID, int user_ID, int role_ID, int trip_ID)
- {
- this.Rights_ID = rights_ID;
- this.User_ID = user_ID;
- this.Role_ID = role_ID;
- this.Trip_ID = trip_ID;
- }
}
}
diff --git a/uthTrip.BLL/DTO/RoleDTO.cs b/uthTrip.BLL/DTO/RoleDTO.cs
index 7e76289..076bf5a 100644
--- a/uthTrip.BLL/DTO/RoleDTO.cs
+++ b/uthTrip.BLL/DTO/RoleDTO.cs
@@ -1,15 +1,14 @@
-namespace UthTrip.BLL.DTO
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
- public class RoleDTO
+namespace uthTrip.BLL.DTO
+{
+ class RoleDTO
{
public int Role_ID { get; set; }
-
public string Title { get; set; }
}
}
diff --git a/uthTrip.BLL/DTO/TripDTO.cs b/uthTrip.BLL/DTO/TripDTO.cs
index 07e386c..38cd829 100644
--- a/uthTrip.BLL/DTO/TripDTO.cs
+++ b/uthTrip.BLL/DTO/TripDTO.cs
@@ -1,43 +1,35 @@
-namespace UthTrip.BLL.DTO
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+namespace uthTrip.BLL.DTO
+{
public class TripDTO
{
- public TripDTO()
- {
- }
-
- public TripDTO(int trip_ID, string trip_Title, string description, double price, int date_ID, int number_Of_People, int destination_ID, int creator_ID)
- {
- this.Trip_ID = trip_ID;
- this.Trip_Title = trip_Title;
- this.Description = description;
- this.Price = price;
- this.Date_ID = date_ID;
- this.Number_Of_People = number_Of_People;
- this.Destination_ID = destination_ID;
- this.Creator_ID = creator_ID;
- }
-
public int Trip_ID { get; set; }
-
public string Trip_Title { get; set; }
-
public string Description { get; set; }
-
public double Price { get; set; }
-
public int Date_ID { get; set; }
-
public int Number_Of_People { get; set; }
-
public int Destination_ID { get; set; }
-
public int Creator_ID { get; set; }
+ public TripDTO()
+ {
+
+ }
+ public TripDTO(int trip_ID, string trip_Title, string description, double price, int date_ID, int number_Of_People, int destination_ID, int creator_ID)
+ {
+ Trip_ID = trip_ID;
+ Trip_Title = trip_Title;
+ Description = description;
+ Price = price;
+ Date_ID = date_ID;
+ Number_Of_People = number_Of_People;
+ Destination_ID = destination_ID;
+ Creator_ID = creator_ID;
+ }
}
}
diff --git a/uthTrip.BLL/DTO/UserDTO.cs b/uthTrip.BLL/DTO/UserDTO.cs
index 8a924ed..c777d27 100644
--- a/uthTrip.BLL/DTO/UserDTO.cs
+++ b/uthTrip.BLL/DTO/UserDTO.cs
@@ -1,46 +1,37 @@
-namespace UthTrip.BLL.DTO
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Text;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+namespace uthTrip.BLL.DTO
+{
public class UserDTO
{
- public UserDTO()
- {
- }
-
- public UserDTO(int user_ID, string first_Name, string last_Name, string email, string username, string password, DateTime birthday, string photo_Url, string info)
- {
- this.User_ID = user_ID;
- this.First_Name = first_Name;
- this.Last_Name = last_Name;
- this.Email = email;
- this.Username = username;
- this.Password = password;
- this.Birthday = birthday;
- this.Photo_Url = photo_Url;
- this.Info = info;
- }
-
public int User_ID { get; set; }
-
public string First_Name { get; set; }
-
public string Last_Name { get; set; }
-
public string Email { get; set; }
-
public string Username { get; set; }
-
public string Password { get; set; }
-
public DateTime Birthday { get; set; }
-
public string Photo_Url { get; set; }
-
public string Info { get; set; }
+ public UserDTO()
+ {
+
+ }
+ public UserDTO(int user_ID, string first_Name, string last_Name, string email, string username, string password, DateTime birthday, string photo_Url, string info)
+ {
+ User_ID = user_ID;
+ First_Name = first_Name;
+ Last_Name = last_Name;
+ Email = email;
+ Username = username;
+ Password = password;
+ Birthday = birthday;
+ Photo_Url = photo_Url;
+ Info = info;
+ }
}
}
diff --git a/uthTrip.BLL/Infrastructure/ServiceModule.cs b/uthTrip.BLL/Infrastructure/ServiceModule.cs
index 874f4e1..bab74d6 100644
--- a/uthTrip.BLL/Infrastructure/ServiceModule.cs
+++ b/uthTrip.BLL/Infrastructure/ServiceModule.cs
@@ -1,26 +1,24 @@
-namespace UthTrip.BLL.Infrastructure
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Ninject.Modules;
- using UthTrip.DAL.Interfaces;
- using UthTrip.DAL.Repositories;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Ninject.Modules;
+using uthTrip.DAL.Interfaces;
+using uthTrip.DAL.Repositories;
+namespace uthTrip.BLL.Infrastructure
+{
public class ServiceModule : NinjectModule
{
private string connectionString;
-
public ServiceModule(string connection)
{
- this.connectionString = connection;
+ connectionString = connection;
}
-
public override void Load()
{
- this.Bind().To().WithConstructorArgument(this.connectionString);
+ Bind().To().WithConstructorArgument(connectionString);
}
}
}
diff --git a/uthTrip.BLL/Infrastructure/ValidationException.cs b/uthTrip.BLL/Infrastructure/ValidationException.cs
index 84fb932..1509aca 100644
--- a/uthTrip.BLL/Infrastructure/ValidationException.cs
+++ b/uthTrip.BLL/Infrastructure/ValidationException.cs
@@ -1,19 +1,17 @@
-namespace UthTrip.BLL.Infrastructure
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+namespace uthTrip.BLL.Infrastructure
+{
public class ValidationException : Exception
{
- public ValidationException(string message, string prop)
- : base(message)
+ public string Property { get; protected set; }
+ public ValidationException(string message, string prop) : base(message)
{
- this.Property = prop;
+ Property = prop;
}
-
- public string Property { get; protected set; }
- }
+ }
}
diff --git a/uthTrip.BLL/Interfaces/IDateRangeService.cs b/uthTrip.BLL/Interfaces/IDateRangeService.cs
index d0f6d39..d9d09e4 100644
--- a/uthTrip.BLL/Interfaces/IDateRangeService.cs
+++ b/uthTrip.BLL/Interfaces/IDateRangeService.cs
@@ -1,26 +1,23 @@
-namespace UthTrip.BLL.Interfaces
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.BLL.Interfaces;
+using uthTrip.BLL.DTO;
+
+namespace uthTrip.BLL.Interfaces
+{
public interface IDateRangeService
{
void CreateDateRange(DatesRangeDTO dateRangeDto);
-
DatesRangeDTO GetById(int? id);
-
IEnumerable GetAll();
-
void Dispose(int id);
-
int FindMaxId();
- ////int Authenticate(string username, string password);
- //// void Update(User user, string password = null);
- ////void Create(string username, string password);
+ //int Authenticate(string username, string password);
+ // void Update(User user, string password = null);
+ //void Create(string username, string password);
}
}
diff --git a/uthTrip.BLL/Interfaces/IDestinationService.cs b/uthTrip.BLL/Interfaces/IDestinationService.cs
index e71429a..f2722b1 100644
--- a/uthTrip.BLL/Interfaces/IDestinationService.cs
+++ b/uthTrip.BLL/Interfaces/IDestinationService.cs
@@ -1,26 +1,23 @@
-namespace UthTrip.BLL.Interfaces
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.BLL.Interfaces;
+using uthTrip.BLL.DTO;
+
+namespace uthTrip.BLL.Interfaces
+{
public interface IDestinationService
{
void CreateDestination(DestinationDTO destinationDto);
-
DestinationDTO GetById(int? id);
-
IEnumerable GetAll();
-
void Dispose(int id);
-
int FindMaxId();
- ////int Authenticate(string username, string password);
- //// void Update(User user, string password = null);
- ////void Create(string username, string password);
+ //int Authenticate(string username, string password);
+ // void Update(User user, string password = null);
+ //void Create(string username, string password);
}
}
diff --git a/uthTrip.BLL/Interfaces/IReviewService.cs b/uthTrip.BLL/Interfaces/IReviewService.cs
deleted file mode 100644
index e42a421..0000000
--- a/uthTrip.BLL/Interfaces/IReviewService.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace UthTrip.BLL.Interfaces
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Interfaces;
-
- public interface IReviewService
- {
- void CreateReview(ReviewDTO reviewDTO);
-
- IEnumerable GetAll();
-
- IEnumerable GetAllTrips();
-
- int FindMaxId();
- }
-}
diff --git a/uthTrip.BLL/Interfaces/IRightsService.cs b/uthTrip.BLL/Interfaces/IRightsService.cs
deleted file mode 100644
index b53cd2c..0000000
--- a/uthTrip.BLL/Interfaces/IRightsService.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace UthTrip.BLL.Interfaces
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Interfaces;
-
- public interface IRightsService
- {
- void CreateRights(RightDTO rightDto);
-
- RightDTO GetById(int? id);
-
- IEnumerable GetAll();
-
- void Dispose(int id);
-
- int FindMaxId();
-
- IEnumerable GetAllRoles();
- ////int Authenticate(string username, string password);
- //// void Update(User user, string password = null);
- ////void Create(string username, string password);
- }
-}
diff --git a/uthTrip.BLL/Interfaces/ITripService.cs b/uthTrip.BLL/Interfaces/ITripService.cs
index 0f1927d..f421327 100644
--- a/uthTrip.BLL/Interfaces/ITripService.cs
+++ b/uthTrip.BLL/Interfaces/ITripService.cs
@@ -1,40 +1,28 @@
-namespace UthTrip.BLL.Interfaces
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.BLL.Interfaces;
+using uthTrip.BLL.DTO;
+
+namespace uthTrip.BLL.Interfaces
+{
public interface ITripService
{
void CreateTrip(TripDTO tripDto, DestinationDTO destinationDTO, DatesRangeDTO datesRangeDTO);
-
TripDTO GetById(int? id);
-
IEnumerable GetAll();
-
IEnumerable GetAllDist();
-
IEnumerable GetAllDateRanges();
- IEnumerable GetAllRights();
-
- IEnumerable GetAllUsers();
-
-
void Dispose(int id);
-
int FindMaxId();
-
int FindMaxIdDestination();
-
int FindMaxIdDateRange();
-
- ////int Authenticate(string username, string password);
- //// void Update(User user, string password = null);
- ////void Create(string username, string password);
+ //int Authenticate(string username, string password);
+ // void Update(User user, string password = null);
+ //void Create(string username, string password);
}
}
diff --git a/uthTrip.BLL/Interfaces/IUserService.cs b/uthTrip.BLL/Interfaces/IUserService.cs
index 4b393d0..ee3bc5c 100644
--- a/uthTrip.BLL/Interfaces/IUserService.cs
+++ b/uthTrip.BLL/Interfaces/IUserService.cs
@@ -1,41 +1,33 @@
-namespace UthTrip.BLL.Interfaces
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.BLL.Interfaces;
+using uthTrip.BLL.DTO;
+
+namespace uthTrip.BLL.Interfaces
{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Interfaces;
-
public interface IUserService
{
void CreateUser(UserDTO userDto);
-
- void CreateBlocked(BlockedUsersDTO userDto);
-
UserDTO GetById(int? id);
-
- UserDTO Get(int userAccountId);
-
+<<<<<<< HEAD
+<<<<<<< HEAD
+ UserDTO GetByUsernamePassword(string username, string password);
+=======
UserDTO GetByUsernamePassword(string username, string password);
-
+>>>>>>> parent of 3e60396... added unit tests to userservice
+=======
+ UserDTO Get(int userAccountId);
string GetFirstName(int userAccountId);
-
+ UserDTO GetByUsernamePassword(string username, string password);
+>>>>>>> parent of aa645ae... added unit tests for userservice
IEnumerable GetAll();
-
- IEnumerable GetAllReviews();
-
- IEnumerable GetAllTrips();
-
- IEnumerable GetAllBlocked();
-
void Dispose(int id);
- void DisposeBlocked(int id);
-
-
int FindMaxId();
-
- int FindMaxIdBl();
+ //int Authenticate(string username, string password);
+ // void Update(User user, string password = null);
+ //void Create(string username, string password);
}
}
diff --git a/uthTrip.BLL/Properties/AssemblyInfo.cs b/uthTrip.BLL/Properties/AssemblyInfo.cs
index 338c0d0..36d5916 100644
--- a/uthTrip.BLL/Properties/AssemblyInfo.cs
+++ b/uthTrip.BLL/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@
// 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("UthTrip.BLL")]
+[assembly: AssemblyTitle("uthTrip.BLL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UthTrip.BLL")]
+[assembly: AssemblyProduct("uthTrip.BLL")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/uthTrip.BLL/Services/DateRangeService.cs b/uthTrip.BLL/Services/DateRangeService.cs
index 740c6a6..10b0fc8 100644
--- a/uthTrip.BLL/Services/DateRangeService.cs
+++ b/uthTrip.BLL/Services/DateRangeService.cs
@@ -1,32 +1,30 @@
-namespace UthTrip.BLL.Services
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using AutoMapper;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.DAL.Entities;
- ////using UthTrip.BLL.BusinessModels;
- using UthTrip.DAL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.BLL.DTO;
+using uthTrip.DAL.Entities;
+//using uthTrip.BLL.BusinessModels;
+using uthTrip.DAL.Interfaces;
+using uthTrip.BLL.Infrastructure;
+using uthTrip.BLL.Interfaces;
+using AutoMapper;
+namespace uthTrip.BLL.Services
+{
public class DateRangeService : IDateRangeService
{
- public DateRangeService(IUnitOfWork uow)
- {
- this.Database = uow;
- }
-
- private IUnitOfWork Database { get; set; }
-
+ IUnitOfWork Database { get; set; }
public int FindMaxId()
{
- int max = this.Database.Dates_ranges.MaxId();
+ int max = Database.Dates_ranges.MaxId();
return max;
}
+ public DateRangeService(IUnitOfWork uow)
+ {
+ Database = uow;
+ }
public void CreateDateRange(DatesRangeDTO dateRangeDto)
{
@@ -34,71 +32,67 @@ public void CreateDateRange(DatesRangeDTO dateRangeDto)
{
Date_ID = dateRangeDto.Date_ID,
Start_date = dateRangeDto.Start_date,
- End_date = dateRangeDto.End_date,
+ End_date = dateRangeDto.End_date
};
- this.Database.Dates_ranges.Create(dateRange);
- this.Database.Save();
+ Database.Dates_ranges.Create(dateRange);
+ Database.Save();
}
- ////public int Authenticate(string username, string password)
- ////{
- //// if (string.IsNullOrEmpty(username))
- //// {
- //// throw new Exception("Username is empty.");
- //// }
- //// else if (string.IsNullOrEmpty(password))
- //// {
- //// throw new Exception("Password is empty.");
- //// }
- //// var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
- //// if (user == null)
- //// {
- //// throw new Exception("User with current name does not exist.");
- //// }
- //// else if (!VerifyHash(password, user.Hash))
- //// {
- //// throw new Exception("Invalid password.");
- //// }
+ //public int Authenticate(string username, string password)
+ //{
+ // if (string.IsNullOrEmpty(username))
+ // {
+ // throw new Exception("Username is empty.");
+ // }
+ // else if (string.IsNullOrEmpty(password))
+ // {
+ // throw new Exception("Password is empty.");
+ // }
- //// return user.Id;
- ////}
+ // var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
+ // if (user == null)
+ // {
+ // throw new Exception("User with current name does not exist.");
+ // }
+ // else if (!VerifyHash(password, user.Hash))
+ // {
+ // throw new Exception("Invalid password.");
+ // }
+
+ // return user.Id;
+ //}
DatesRangeDTO IDateRangeService.GetById(int? id)
{
if (id == null)
- {
- throw new ValidationException("ID not set.", string.Empty);
- }
-
- var dateRange = this.Database.Dates_ranges.Get(id.Value);
+ throw new ValidationException("ID not set.", "");
+ var dateRange = Database.Dates_ranges.Get(id.Value);
if (dateRange == null)
- {
- throw new ValidationException("dateRange with this ID was not found", string.Empty);
- }
+ throw new ValidationException("dateRange with this ID was not found", "");
return new DatesRangeDTO
{
Date_ID = dateRange.Date_ID,
Start_date = dateRange.Start_date,
- End_date = dateRange.End_date,
+ End_date = dateRange.End_date
};
}
-
+
public IEnumerable GetAll()
{
var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Dates_ranges.GetAll());
+ return mapper.Map, List>(Database.Dates_ranges.GetAll());
}
-
public void Dispose(int id)
{
- var dateRange = this.Database.Dates_ranges.Get(id);
+ var dateRange = Database.Dates_ranges.Get(id);
if (dateRange != null)
{
- this.Database.Dates_ranges.Delete(id);
- this.Database.Save();
+ Database.Dates_ranges.Delete(id);
+ Database.Save();
}
}
}
-}
\ No newline at end of file
+}
+
diff --git a/uthTrip.BLL/Services/DestinationService.cs b/uthTrip.BLL/Services/DestinationService.cs
index 412a563..85e6225 100644
--- a/uthTrip.BLL/Services/DestinationService.cs
+++ b/uthTrip.BLL/Services/DestinationService.cs
@@ -1,105 +1,97 @@
-namespace UthTrip.BLL.Services
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using AutoMapper;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.DAL.Entities;
- ////using UthTrip.BLL.BusinessModels;
- using UthTrip.DAL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.BLL.DTO;
+using uthTrip.DAL.Entities;
+//using uthTrip.BLL.BusinessModels;
+using uthTrip.DAL.Interfaces;
+using uthTrip.BLL.Infrastructure;
+using uthTrip.BLL.Interfaces;
+using AutoMapper;
- public class DestinationService : IDestinationService
+namespace uthTrip.BLL.Services
+{
+ public class DestinationService:IDestinationService
{
- public DestinationService(IUnitOfWork uow)
- {
- this.Database = uow;
- }
-
- private IUnitOfWork Database { get; set; }
-
+ IUnitOfWork Database { get; set; }
public int FindMaxId()
{
- int max = this.Database.Destinations.MaxId();
+ int max = Database.Destinations.MaxId();
return max;
}
-
+ public DestinationService(IUnitOfWork uow)
+ {
+ Database = uow;
+ }
public void CreateDestination(DestinationDTO destinationDto)
{
Destination destination = new Destination
{
- Destination_ID = destinationDto.Destination_ID,
- Is_Abroad = destinationDto.Is_Abroad,
- Country = destinationDto.Country,
- City = destinationDto.City,
+ Destination_ID= destinationDto.Destination_ID,
+ Is_Abroad=destinationDto.Is_Abroad,
+ Country=destinationDto.Country,
+ City=destinationDto.City
};
- this.Database.Destinations.Create(destination);
- this.Database.Save();
+ Database.Destinations.Create(destination);
+ Database.Save();
}
- ////public int Authenticate(string username, string password)
- ////{
- //// if (string.IsNullOrEmpty(username))
- //// {
- //// throw new Exception("Username is empty.");
- //// }
- //// else if (string.IsNullOrEmpty(password))
- //// {
- //// throw new Exception("Password is empty.");
- //// }
+ //public int Authenticate(string username, string password)
+ //{
+ // if (string.IsNullOrEmpty(username))
+ // {
+ // throw new Exception("Username is empty.");
+ // }
+ // else if (string.IsNullOrEmpty(password))
+ // {
+ // throw new Exception("Password is empty.");
+ // }
+
+ // var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
+ // if (user == null)
+ // {
+ // throw new Exception("User with current name does not exist.");
+ // }
+ // else if (!VerifyHash(password, user.Hash))
+ // {
+ // throw new Exception("Invalid password.");
+ // }
- //// var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
- //// if (user == null)
- //// {
- //// throw new Exception("User with current name does not exist.");
- //// }
- //// else if (!VerifyHash(password, user.Hash))
- //// {
- //// throw new Exception("Invalid password.");
- //// }
+ // return user.Id;
+ //}
- //// return user.Id;
- ////}
public DestinationDTO GetById(int? id)
{
if (id == null)
- {
- throw new ValidationException("ID not set.", string.Empty);
- }
-
- var destination = this.Database.Destinations.Get(id.Value);
+ throw new ValidationException("ID not set.", "");
+ var destination = Database.Destinations.Get(id.Value);
if (destination == null)
- {
- throw new ValidationException("Destination with this ID was not found", string.Empty);
- }
+ throw new ValidationException("Destination with this ID was not found", "");
return new DestinationDTO
{
Destination_ID = destination.Destination_ID,
Is_Abroad = destination.Is_Abroad,
Country = destination.Country,
- City = destination.City,
+ City = destination.City
};
}
-
public IEnumerable GetAll()
{
var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Destinations.GetAll());
+ return mapper.Map, List>(Database.Destinations.GetAll());
}
-
public void Dispose(int id)
{
- var trip = this.Database.Destinations.Get(id);
+ var trip = Database.Destinations.Get(id);
if (trip != null)
{
- this.Database.Destinations.Delete(id);
- this.Database.Save();
+ Database.Destinations.Delete(id);
+ Database.Save();
}
}
+
}
}
diff --git a/uthTrip.BLL/Services/ReviewService.cs b/uthTrip.BLL/Services/ReviewService.cs
deleted file mode 100644
index 01b7012..0000000
--- a/uthTrip.BLL/Services/ReviewService.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-////using Microsoft.EntityFrameworkCore;
-namespace UthTrip.BLL.Services
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- using AutoMapper;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- ////using UthTrip.BLL.BusinessModels;
- using UthTrip.DAL.Interfaces;
-
- public class ReviewService : IReviewService
- {
- public ReviewService(IUnitOfWork uow)
- {
- this.Database = uow;
- }
-
- public IUnitOfWork Database { get; set; }
-
- public int FindMaxId()
- {
- int max = this.Database.Reviews.MaxId();
- return max;
- }
-
- public void CreateReview(ReviewDTO reviewDTO)
- {
- Review review = new Review
- {
- Review_ID = reviewDTO.Review_ID,
- Writer_ID = reviewDTO.Writer_ID,
- Trip_ID = reviewDTO.Trip_ID,
- Review1 = reviewDTO.Review1,
- Mark = reviewDTO.Mark,
-
- };
-
- this.Database.Reviews.Create(review);
- this.Database.Save();
- }
-
- public IEnumerable GetAll()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Reviews.GetAll());
- }
-
- public IEnumerable GetAllTrips()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Trips.GetAll());
- }
-
- }
-}
\ No newline at end of file
diff --git a/uthTrip.BLL/Services/RightsService.cs b/uthTrip.BLL/Services/RightsService.cs
deleted file mode 100644
index d089518..0000000
--- a/uthTrip.BLL/Services/RightsService.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-namespace UthTrip.BLL.Services
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using AutoMapper;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.DAL.Entities;
- ////using UthTrip.BLL.BusinessModels;
- using UthTrip.DAL.Interfaces;
-
- public class RightsService : IRightsService
- {
- public RightsService(IUnitOfWork uow)
- {
- this.Database = uow;
- }
-
- private IUnitOfWork Database { get; set; }
-
- public int FindMaxId()
- {
- int max = this.Database.Rights.MaxId();
- return max;
- }
-
- public void CreateRights(RightDTO rightsDto)
- {
- Right rights = new Right
- {
- Rights_ID = rightsDto.Rights_ID,
- Role_ID = rightsDto.Role_ID,
- Trip_ID = rightsDto.Trip_ID,
- User_ID = rightsDto.User_ID,
-
- };
- try
- {
- this.Database.Rights.GetAll().Where(e => e.Role_ID == rights.Role_ID && e.Trip_ID == rights.Trip_ID && e.User_ID == rights.User_ID).First();
- throw new ArgumentNullException();
- }
- catch (System.InvalidOperationException)
- {
- this.Database.Rights.Create(rights);
- this.Database.Save();
- }
- }
-
- ////public int Authenticate(string username, string password)
- ////{
- //// if (string.IsNullOrEmpty(username))
- //// {
- //// throw new Exception("Username is empty.");
- //// }
- //// else if (string.IsNullOrEmpty(password))
- //// {
- //// throw new Exception("Password is empty.");
- //// }
-
- //// var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
- //// if (user == null)
- //// {
- //// throw new Exception("User with current name does not exist.");
- //// }
- //// else if (!VerifyHash(password, user.Hash))
- //// {
- //// throw new Exception("Invalid password.");
- //// }
-
- //// return user.Id;
- ////}
-
- RightDTO IRightsService.GetById(int? id)
- {
- if (id == null)
- {
- throw new ValidationException("ID not set.", string.Empty);
- }
-
- var rights = this.Database.Rights.Get(id.Value);
- if (rights == null)
- {
- throw new ValidationException("rights with this ID was not found", string.Empty);
- }
-
- return new RightDTO
- {
- Rights_ID = rights.Rights_ID,
- Role_ID = rights.Role_ID,
- User_ID = rights.User_ID,
- Trip_ID = rights.Trip_ID,
- };
- }
-
- public IEnumerable GetAll()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Rights.GetAll());
- }
-
- public void Dispose(int id)
- {
- var rights = this.Database.Rights.Get(id);
- if (rights != null)
- {
- this.Database.Rights.Delete(id);
- this.Database.Save();
- }
- }
-
- public IEnumerable GetAllRoles()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Roles.GetAll());
- }
- }
-}
\ No newline at end of file
diff --git a/uthTrip.BLL/Services/TripService.cs b/uthTrip.BLL/Services/TripService.cs
index 7dc6e7b..79309c4 100644
--- a/uthTrip.BLL/Services/TripService.cs
+++ b/uthTrip.BLL/Services/TripService.cs
@@ -1,112 +1,100 @@
-namespace UthTrip.BLL.Services
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.BLL.DTO;
+using uthTrip.DAL.Entities;
+//using uthTrip.BLL.BusinessModels;
+using uthTrip.DAL.Interfaces;
+using uthTrip.BLL.Infrastructure;
+using uthTrip.BLL.Interfaces;
+using AutoMapper;
+
+namespace uthTrip.BLL.Services
{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using AutoMapper;
- ////using UthTrip.BLL.BusinessModels;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
-
public class TripService : ITripService
{
- public TripService()
+ IUnitOfWork Database { get; set; }
+ public int FindMaxId()
{
+ int max = Database.Trips.MaxId();
+ return max;
}
-
- public TripService(IUnitOfWork uow)
+ public TripService()
{
- this.Database = uow;
- }
- private IUnitOfWork Database { get; set; }
-
- public int FindMaxId()
+ }
+ public TripService(IUnitOfWork uow)
{
- int max = this.Database.Trips.MaxId();
- return max;
+ Database = uow;
}
-
public void CreateTrip(TripDTO tripDto, DestinationDTO destinationDTO, DatesRangeDTO datesRangeDTO)
{
Trip trip = new Trip
{
Trip_ID = tripDto.Trip_ID,
- Trip_Title = tripDto.Trip_Title,
- Description = tripDto.Description,
- Price = tripDto.Price,
- Date_ID = tripDto.Date_ID,
- Number_Of_People = tripDto.Number_Of_People,
- Destination_ID = tripDto.Destination_ID,
- Creator_ID = tripDto.Creator_ID,
+ Trip_Title=tripDto.Trip_Title,
+ Description=tripDto.Description,
+ Price=tripDto.Price,
+ Date_ID=tripDto.Date_ID,
+ Number_Of_People=tripDto.Number_Of_People,
+ Destination_ID=tripDto.Destination_ID,
+ Creator_ID =tripDto.Creator_ID
};
Destination destination = new Destination
{
Destination_ID = destinationDTO.Destination_ID,
Is_Abroad = destinationDTO.Is_Abroad,
Country = destinationDTO.Country,
- City = destinationDTO.City,
+ City = destinationDTO.City
};
Dates_ranges dates_Ranges = new Dates_ranges
{
Date_ID = datesRangeDTO.Date_ID,
Start_date = datesRangeDTO.Start_date,
- End_date = datesRangeDTO.End_date,
+ End_date = datesRangeDTO.End_date
};
- try
- {
- this.Database.Trips.GetAll().Where(e => e.Trip_Title == trip.Trip_Title).First();
- throw new ArgumentNullException();
- }
- catch (System.InvalidOperationException)
- {
- this.Database.Destinations.Create(destination);
- this.Database.Dates_ranges.Create(dates_Ranges);
- this.Database.Trips.Create(trip);
- this.Database.Save();
- }
+ Database.Destinations.Create(destination);
+ Database.Save();
+ Database.Dates_ranges.Create(dates_Ranges);
+ Database.Save();
+ Database.Trips.Create(trip);
+ Database.Save();
+
}
- ////public int Authenticate(string username, string password)
- ////{
- //// if (string.IsNullOrEmpty(username))
- //// {
- //// throw new Exception("Username is empty.");
- //// }
- //// else if (string.IsNullOrEmpty(password))
- //// {
- //// throw new Exception("Password is empty.");
- //// }
+ //public int Authenticate(string username, string password)
+ //{
+ // if (string.IsNullOrEmpty(username))
+ // {
+ // throw new Exception("Username is empty.");
+ // }
+ // else if (string.IsNullOrEmpty(password))
+ // {
+ // throw new Exception("Password is empty.");
+ // }
+
+ // var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
+ // if (user == null)
+ // {
+ // throw new Exception("User with current name does not exist.");
+ // }
+ // else if (!VerifyHash(password, user.Hash))
+ // {
+ // throw new Exception("Invalid password.");
+ // }
+
+ // return user.Id;
+ //}
- //// var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
- //// if (user == null)
- //// {
- //// throw new Exception("User with current name does not exist.");
- //// }
- //// else if (!VerifyHash(password, user.Hash))
- //// {
- //// throw new Exception("Invalid password.");
- //// }
-
- //// return user.Id;
- ////}
public TripDTO GetById(int? id)
{
if (id == null)
- {
- throw new ValidationException("ID not set.", string.Empty);
- }
-
- var trip = this.Database.Trips.Get(id.Value);
+ throw new ValidationException("ID not set.", "");
+ var trip = Database.Trips.Get(id.Value);
if (trip == null)
- {
- throw new ValidationException("Trip with this ID was not found", string.Empty);
- }
+ throw new ValidationException("Trip with this ID was not found", "");
return new TripDTO
{
@@ -117,59 +105,46 @@ public TripDTO GetById(int? id)
Date_ID = trip.Date_ID,
Number_Of_People = trip.Number_Of_People,
Destination_ID = trip.Destination_ID,
- Creator_ID = trip.Creator_ID,
+ Creator_ID = trip.Creator_ID
};
}
-
public IEnumerable GetAll()
{
var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Trips.GetAll());
+ return mapper.Map, List>(Database.Trips.GetAll());
}
-
public void Dispose(int id)
{
- var trip = this.Database.Trips.Get(id);
+ var trip = Database.Trips.Get(id);
if (trip != null)
{
- this.Database.Trips.Delete(id);
- this.Database.Save();
+ Database.Trips.Delete(id);
+ Database.Save();
}
}
public int FindMaxIdDestination()
{
- int max = this.Database.Destinations.MaxId();
+ int max = Database.Destinations.MaxId();
return max;
}
public int FindMaxIdDateRange()
{
- int max = this.Database.Dates_ranges.MaxId();
+ int max = Database.Dates_ranges.MaxId();
return max;
}
public IEnumerable GetAllDist()
{
var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Destinations.GetAll());
+ return mapper.Map, List>(Database.Destinations.GetAll());
}
public IEnumerable GetAllDateRanges()
{
var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Dates_ranges.GetAll());
- }
- public IEnumerable GetAllRights()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Rights.GetAll());
- }
-
- public IEnumerable GetAllUsers()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Users.GetAll());
+ return mapper.Map, List>(Database.Dates_ranges.GetAll());
}
}
}
diff --git a/uthTrip.BLL/Services/UserService.cs b/uthTrip.BLL/Services/UserService.cs
index cd2d66e..f3ce47e 100644
--- a/uthTrip.BLL/Services/UserService.cs
+++ b/uthTrip.BLL/Services/UserService.cs
@@ -1,265 +1,152 @@
-////using Microsoft.EntityFrameworkCore;
-namespace UthTrip.BLL.Services
+using System;
+using uthTrip.BLL.DTO;
+using uthTrip.DAL.Entities;
+//using uthTrip.BLL.BusinessModels;
+using uthTrip.DAL.Interfaces;
+using uthTrip.BLL.Infrastructure;
+using uthTrip.BLL.Interfaces;
+using System.Collections.Generic;
+<<<<<<< HEAD
+using System.Linq;
+<<<<<<< HEAD
+using uthTrip.DAL.EF;
+
+=======
+>>>>>>> parent of 3e60396... added unit tests to userservice
+=======
+>>>>>>> parent of aa645ae... added unit tests for userservice
+using AutoMapper;
+
+namespace uthTrip.BLL.Services
{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- using AutoMapper;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- ////using UthTrip.BLL.BusinessModels;
- using UthTrip.DAL.Interfaces;
-
public class UserService : IUserService
{
- public UserService(IUnitOfWork uow)
- {
- this.Database = uow;
- }
-
public IUnitOfWork Database { get; set; }
-
public int FindMaxId()
{
- int max = this.Database.Users.MaxId();
+ int max = Database.Users.MaxId();
return max;
}
-
- public int FindMaxIdBl()
+ public UserService(IUnitOfWork uow)
{
- int max = this.Database.Blocked_Users.MaxId();
- return max;
+ Database = uow;
}
-
public void CreateUser(UserDTO userDto)
{
User user = new User
{
- User_ID = userDto.User_ID,
+ User_ID=userDto.User_ID,
First_Name = userDto.First_Name,
- Last_Name = userDto.Last_Name,
- Email = userDto.Email,
- Username = userDto.Username,
- Password = userDto.Password,
- Birthday = userDto.Birthday,
- Photo_Url = userDto.Photo_Url,
- Info = userDto.Info,
- };
- try
- {
- this.Database.Users.GetAll().Where(e => e.Username == user.Username).First();
- throw new ArgumentNullException();
- }
- catch (System.InvalidOperationException)
- {
- this.Database.Users.Create(user);
- this.Database.Save();
- }
- }
- public void CreateBlocked(BlockedUsersDTO userDto)
- {
- Blocked_Users user = new Blocked_Users
- {
- User_ID = userDto.User_ID,
- Blocked_ID = userDto.Blocked_ID,
+ Last_Name=userDto.Last_Name,
+ Email=userDto.Email,
+ Username=userDto.Username,
+ Password=userDto.Password,
+ Birthday=userDto.Birthday,
+ Photo_Url=userDto.Photo_Url,
+ Info=userDto.Info
};
- this.Database.Blocked_Users.Create(user);
- this.Database.Save();
- }
-
- ////public int Authenticate(string username, string password)
- ////{
- //// if (string.IsNullOrEmpty(username))
- //// {
- //// throw new Exception("Username is empty.");
- //// }
- //// else if (string.IsNullOrEmpty(password))
- //// {
- //// throw new Exception("Password is empty.");
- //// }
-
- //// var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
- //// if (user == null)
- //// {
- //// throw new Exception("User with current name does not exist.");
- //// }
- //// else if (!VerifyHash(password, user.Hash))
- //// {
- //// throw new Exception("Invalid password.");
- //// }
-
- //// return user.Id;
- ////}
-
+ Database.Users.Create(user);
+ Database.Save();
+ }
+<<<<<<< HEAD
+=======
+ //public int Authenticate(string username, string password)
+ //{
+ // if (string.IsNullOrEmpty(username))
+ // {
+ // throw new Exception("Username is empty.");
+ // }
+ // else if (string.IsNullOrEmpty(password))
+ // {
+ // throw new Exception("Password is empty.");
+ // }
+
+ // var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
+ // if (user == null)
+ // {
+ // throw new Exception("User with current name does not exist.");
+ // }
+ // else if (!VerifyHash(password, user.Hash))
+ // {
+ // throw new Exception("Invalid password.");
+ // }
+
+ // return user.Id;
+ //}
+>>>>>>> parent of 3e60396... added unit tests to userservice
+
public string GetFirstName(int userAccountId)
{
- var result = this.GetAllUsers()
+ var result = GetAllUsers()
.Where(x => x.User_ID == userAccountId)
.Select(x => x.First_Name)
.FirstOrDefault();
return result;
}
-
public UserDTO Get(int userAccountId)
{
- var userAccount = this.GetAllUsers()
+ var userAccount = GetAllUsers()
.FirstOrDefault(x => x.User_ID == userAccountId);
return userAccount;
}
- ////public int Authenticate(string username, string password)
- ////{
- //// if (string.IsNullOrEmpty(username))
- //// {
- //// throw new Exception("Username is empty.");
- //// }
- //// else if (string.IsNullOrEmpty(password))
- //// {
- //// throw new Exception("Password is empty.");
- //// }
-
- //// var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
- //// if (user == null)
- //// {
- //// throw new Exception("User with current name does not exist.");
- //// }
- //// else if (!VerifyHash(password, user.Hash))
- //// {
- //// throw new Exception("Invalid password.");
- //// }
+ //public int Authenticate(string username, string password)
+ //{
+ // if (string.IsNullOrEmpty(username))
+ // {
+ // throw new Exception("Username is empty.");
+ // }
+ // else if (string.IsNullOrEmpty(password))
+ // {
+ // throw new Exception("Password is empty.");
+ // }
+
+ // var user = Database.Users.Find(u => u.Username == username).SingleOrDefault();
+ // if (user == null)
+ // {
+ // throw new Exception("User with current name does not exist.");
+ // }
+ // else if (!VerifyHash(password, user.Hash))
+ // {
+ // throw new Exception("Invalid password.");
+ // }
+
+ // return user.Id;
+ //}
- //// return user.Id;
- ////}
public UserDTO GetById(int? id)
{
if (id == null)
- {
- throw new ValidationException("ID not set.", string.Empty);
- }
-
- var user = this.Database.Users.Get(id.Value);
+ throw new ValidationException("ID not set.", "");
+ var user = Database.Users.Get(id.Value);
if (user == null)
- {
- throw new ValidationException("User with this ID was not found", string.Empty);
- }
+ throw new ValidationException("User with this ID was not found", "");
- return new UserDTO
- {
- User_ID = user.User_ID,
- First_Name = user.First_Name,
- Last_Name = user.Last_Name,
- Email = user.Email,
- Username = user.Username,
- Password = user.Password,
- Info = user.Info,
- Birthday = user.Birthday,
- Photo_Url = user.Photo_Url,
- };
+ return new UserDTO { User_ID=user.User_ID, First_Name = user.First_Name,Last_Name=user.Last_Name,
+ Email=user.Email, Username=user.Username, Password=user.Password,Info=user.Info, Birthday=user.Birthday, Photo_Url=user.Photo_Url};
}
-
public IEnumerable GetAll()
{
var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Users.GetAll());
+ return mapper.Map, List>(Database.Users.GetAll());
}
-
- public IEnumerable GetAllReviews()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Reviews.GetAll());
- }
-
- public IEnumerable GetAllTrips()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Trips.GetAll());
- }
-
- public IEnumerable GetAllBlocked()
- {
- var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
- return mapper.Map, List>(this.Database.Blocked_Users.GetAll());
- }
-
public void Dispose(int id)
{
- var user = this.Database.Users.Get(id);
+ var user = Database.Users.Get(id);
if (user != null)
{
- this.Database.Users.Delete(id);
- this.Database.Save();
+ Database.Users.Delete(id);
+ Database.Save();
}
}
- public void DisposeBlocked(int id)
- {
- var user = this.Database.Blocked_Users.Get(id);
- if (user != null)
- {
- this.Database.Blocked_Users.Delete(id);
- this.Database.Save();
- }
- }
-
- public static string strKey = "U2A9/R*41FD412+4-123";
-
- public static string Encrypt(string strData)
- {
- string strValue = " ";
- if (!string.IsNullOrEmpty(strKey))
- {
- if (strKey.Length < 16)
- {
- char c = "XXXXXXXXXXXXXXXX"[16];
- strKey = strKey + strKey.Substring(0, 16 - strKey.Length);
- }
-
- if (strKey.Length > 16)
- {
- strKey = strKey.Substring(0, 16);
- }
-
- // create encryption keys
- byte[] byteKey = Encoding.UTF8.GetBytes(strKey.Substring(0, 8));
- byte[] byteVector = Encoding.UTF8.GetBytes(strKey.Substring(strKey.Length - 8, 8));
-
- // convert data to byte array
- byte[] byteData = Encoding.UTF8.GetBytes(strData);
-
- // encrypt
- DESCryptoServiceProvider objDES = new DESCryptoServiceProvider();
- MemoryStream objMemoryStream = new MemoryStream();
- CryptoStream objCryptoStream = new CryptoStream(objMemoryStream, objDES.CreateEncryptor(byteKey, byteVector), CryptoStreamMode.Write);
- objCryptoStream.Write(byteData, 0, byteData.Length);
- objCryptoStream.FlushFinalBlock();
-
- // convert to string and Base64 encode
- strValue = Convert.ToBase64String(objMemoryStream.ToArray());
- }
- else
- {
- strValue = strData;
- }
-
- return strValue;
- }
-
-
-
public UserDTO GetByUsernamePassword(string username, string password)
{
try
{
- var user = this.Database.Users.GetbyPass(username, Encrypt(password));
+ var user = Database.Users.GetbyPass(username, password);
return new UserDTO
{
User_ID = user.User_ID,
@@ -270,7 +157,7 @@ public UserDTO GetByUsernamePassword(string username, string password)
Password = user.Password,
Info = user.Info,
Birthday = user.Birthday,
- Photo_Url = user.Photo_Url,
+ Photo_Url = user.Photo_Url
};
}
catch (System.NullReferenceException)
@@ -278,37 +165,47 @@ public UserDTO GetByUsernamePassword(string username, string password)
return null;
}
}
-
- private List GetAllUsers()
- {
+<<<<<<< HEAD
+<<<<<<< HEAD
+=======
+ private List GetAllUsers()
+ {
DateTime somedate = new DateTime(2000, 07, 21);
return new List()
{
+
+
+>>>>>>> parent of aa645ae... added unit tests for userservice
+
new UserDTO
{
User_ID = 123,
First_Name = "Simon",
Last_Name = "Gilbert",
Username = "simongilbert",
- Email = "simongilbert@com",
+ Email= "simongilbert@com",
Password = "1111",
Birthday = somedate,
Photo_Url = "www",
- Info = "some boy",
+ Info = "some boy"
+
},
- new UserDTO
+ new UserDTO
{
User_ID = 456,
First_Name = "Alexander",
Last_Name = "Hill",
Username = "alexhill",
- Email = "alexhill@com",
+ Email= "alexhill@com",
Password = "1111",
Birthday = somedate,
Photo_Url = "www",
- Info = "anpther boy",
+ Info = "anpther boy"
},
};
+ }
}
+=======
+>>>>>>> parent of 3e60396... added unit tests to userservice
}
-}
\ No newline at end of file
+}
diff --git a/uthTrip.BLL/packages.config b/uthTrip.BLL/packages.config
index be2127f..f2f5f08 100644
--- a/uthTrip.BLL/packages.config
+++ b/uthTrip.BLL/packages.config
@@ -1,30 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/uthTrip.BLL/stylecop.json b/uthTrip.BLL/stylecop.json
deleted file mode 100644
index 42fb1f8..0000000
--- a/uthTrip.BLL/stylecop.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- // ACTION REQUIRED: This file was automatically added to your project, but it
- // will not take effect until additional steps are taken to enable it. See the
- // following page for additional information:
- //
- // https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md
-
- "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
- "settings": {
- "documentationRules": {
- "companyName": "PlaceholderCompany"
- }
- }
-}
diff --git a/uthTrip.BLL/uthTrip.BLL.csproj b/uthTrip.BLL/uthTrip.BLL.csproj
index 8249bad..e704b66 100644
--- a/uthTrip.BLL/uthTrip.BLL.csproj
+++ b/uthTrip.BLL/uthTrip.BLL.csproj
@@ -34,84 +34,14 @@
..\packages\AutoMapper.9.0.0\lib\net461\AutoMapper.dll
-
- ..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0-preview3.19551.4\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
-
-
- ..\packages\Microsoft.Bcl.HashCode.1.1.0-preview3.19551.4\lib\net461\Microsoft.Bcl.HashCode.dll
-
-
- ..\packages\Microsoft.EntityFrameworkCore.3.1.0-preview3.19554.8\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll
-
-
- ..\packages\Microsoft.EntityFrameworkCore.Abstractions.3.1.0-preview3.19554.8\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Caching.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Caching.Memory.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll
-
-
- ..\packages\Microsoft.Extensions.Configuration.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll
-
-
- ..\packages\Microsoft.Extensions.Configuration.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Configuration.Binder.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll
-
-
- ..\packages\Microsoft.Extensions.DependencyInjection.3.1.0-preview3.19553.2\lib\net461\Microsoft.Extensions.DependencyInjection.dll
-
-
- ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Logging.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Logging.dll
-
-
- ..\packages\Microsoft.Extensions.Logging.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll
-
-
- ..\packages\Microsoft.Extensions.Options.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Options.dll
-
-
- ..\packages\Microsoft.Extensions.Primitives.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll
-
..\packages\Ninject.3.3.4\lib\net45\Ninject.dll
-
- ..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll
-
-
- ..\packages\System.Collections.Immutable.1.7.0-preview3.19551.4\lib\netstandard2.0\System.Collections.Immutable.dll
-
-
- ..\packages\System.ComponentModel.Annotations.4.7.0-preview3.19551.4\lib\net461\System.ComponentModel.Annotations.dll
-
-
- ..\packages\System.Diagnostics.DiagnosticSource.4.7.0-preview3.19551.4\lib\net46\System.Diagnostics.DiagnosticSource.dll
-
-
- ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll
-
-
-
- ..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll
-
-
- ..\packages\System.Runtime.CompilerServices.Unsafe.4.7.0-preview3.19551.4\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
-
-
- ..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll
-
@@ -131,17 +61,13 @@
-
-
-
-
@@ -156,11 +82,6 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/uthTrip.DAL/App.config b/uthTrip.DAL/App.config
index 094aaab..d94ae4e 100644
--- a/uthTrip.DAL/App.config
+++ b/uthTrip.DAL/App.config
@@ -10,8 +10,10 @@
-
+
+<<<<<<< Updated upstream
+=======
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>>>>>>> Stashed changes
\ No newline at end of file
diff --git a/uthTrip.DAL/Class1.cs b/uthTrip.DAL/Class1.cs
index 7623291..f5b94cc 100644
--- a/uthTrip.DAL/Class1.cs
+++ b/uthTrip.DAL/Class1.cs
@@ -1,11 +1,11 @@
-namespace UthTrip.DAL
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+namespace uthTrip.DAL
+{
public class Class1
{
}
diff --git a/uthTrip.DAL/EF/uthtripContext.cs b/uthTrip.DAL/EF/uthtripContext.cs
index 286fb5b..e6b2095 100644
--- a/uthTrip.DAL/EF/uthtripContext.cs
+++ b/uthTrip.DAL/EF/uthtripContext.cs
@@ -1,39 +1,37 @@
-namespace UthTrip.DAL.EF
+namespace uthTrip.DAL.EF
{
using System;
+ using System.Data.Common;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
- using UthTrip.DAL.Entities;
- //// /using Microsoft.EntityFrameworkCore;
- public partial class UthTripContext : DbContext
+ using uthTrip.DAL.Entities;
+
+ public partial class uthtripContext : DbContext
{
private string connectionString;
-
- public UthTripContext(string conString)
+
+ public uthtripContext(string conString)
{
- this.connectionString = conString;
+ connectionString = conString;
}
-
- public UthTripContext()
- : base("name=UthTripContext")
+ public uthtripContext()
+ : base("name=uthtripContext")
{
}
+ public UthTripContext(DbConnection connection)
+ : base(connection, true)
+ {
+ Configuration.LazyLoadingEnabled = false;
+ }
public virtual DbSet Blocked_Users { get; set; }
-
public virtual DbSet Dates_ranges { get; set; }
-
public virtual DbSet Destinations { get; set; }
-
public virtual DbSet Reviews { get; set; }
-
public virtual DbSet Rights { get; set; }
-
public virtual DbSet Roles { get; set; }
-
public virtual DbSet Trips { get; set; }
-
public virtual DbSet Users { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
diff --git a/uthTrip.DAL/Entities/Blocked_Users.cs b/uthTrip.DAL/Entities/Blocked_Users.cs
index 6ee2bce..11f72b6 100644
--- a/uthTrip.DAL/Entities/Blocked_Users.cs
+++ b/uthTrip.DAL/Entities/Blocked_Users.cs
@@ -1,4 +1,4 @@
-namespace UthTrip.DAL.Entities
+namespace uthTrip.DAL.Entities
{
using System;
using System.Collections.Generic;
diff --git a/uthTrip.DAL/Entities/Dates_ranges.cs b/uthTrip.DAL/Entities/Dates_ranges.cs
index 076ada4..99cce95 100644
--- a/uthTrip.DAL/Entities/Dates_ranges.cs
+++ b/uthTrip.DAL/Entities/Dates_ranges.cs
@@ -1,4 +1,4 @@
-namespace UthTrip.DAL.Entities
+namespace uthTrip.DAL.Entities
{
using System;
using System.Collections.Generic;
@@ -8,10 +8,10 @@ namespace UthTrip.DAL.Entities
public partial class Dates_ranges
{
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Dates_ranges()
{
- this.Trips = new HashSet();
+ Trips = new HashSet();
}
[Key]
@@ -24,7 +24,7 @@ public Dates_ranges()
[Column(TypeName = "date")]
public DateTime? End_date { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Trips { get; set; }
}
}
diff --git a/uthTrip.DAL/Entities/Destination.cs b/uthTrip.DAL/Entities/Destination.cs
index 45dfce5..e3611ec 100644
--- a/uthTrip.DAL/Entities/Destination.cs
+++ b/uthTrip.DAL/Entities/Destination.cs
@@ -1,4 +1,4 @@
-namespace UthTrip.DAL.Entities
+namespace uthTrip.DAL.Entities
{
using System;
using System.Collections.Generic;
@@ -8,10 +8,10 @@ namespace UthTrip.DAL.Entities
public partial class Destination
{
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Destination()
{
- this.Trips = new HashSet();
+ Trips = new HashSet();
}
[Key]
@@ -20,13 +20,13 @@ public Destination()
public bool Is_Abroad { get; set; }
- [StringLength(50)]
+ [StringLength(50,MinimumLength = 5)]
public string Country { get; set; }
- [StringLength(100)]
+ [StringLength(100, MinimumLength = 5)]
public string City { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Trips { get; set; }
}
}
diff --git a/uthTrip.DAL/Entities/Review.cs b/uthTrip.DAL/Entities/Review.cs
index 6baf278..6f3d635 100644
--- a/uthTrip.DAL/Entities/Review.cs
+++ b/uthTrip.DAL/Entities/Review.cs
@@ -1,4 +1,4 @@
-namespace UthTrip.DAL.Entities
+namespace uthTrip.DAL.Entities
{
using System;
using System.Collections.Generic;
diff --git a/uthTrip.DAL/Entities/Right.cs b/uthTrip.DAL/Entities/Right.cs
index fe777e2..1812115 100644
--- a/uthTrip.DAL/Entities/Right.cs
+++ b/uthTrip.DAL/Entities/Right.cs
@@ -1,4 +1,4 @@
-namespace UthTrip.DAL.Entities
+namespace uthTrip.DAL.Entities
{
using System;
using System.Collections.Generic;
@@ -11,7 +11,7 @@ public partial class Right
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Rights_ID { get; set; }
-
+
public int User_ID { get; set; }
public int Role_ID { get; set; }
diff --git a/uthTrip.DAL/Entities/Role.cs b/uthTrip.DAL/Entities/Role.cs
index a059698..111a24f 100644
--- a/uthTrip.DAL/Entities/Role.cs
+++ b/uthTrip.DAL/Entities/Role.cs
@@ -1,4 +1,4 @@
-namespace UthTrip.DAL.Entities
+namespace uthTrip.DAL.Entities
{
using System;
using System.Collections.Generic;
@@ -8,20 +8,20 @@ namespace UthTrip.DAL.Entities
public partial class Role
{
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Role()
{
- this.Rights = new HashSet();
+ Rights = new HashSet();
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Role_ID { get; set; }
- [StringLength(50)]
+ [StringLength(50,MinimumLength = 5)]
public string Title { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Rights { get; set; }
}
}
diff --git a/uthTrip.DAL/Entities/Trip.cs b/uthTrip.DAL/Entities/Trip.cs
index 3e0e2e7..b29e61e 100644
--- a/uthTrip.DAL/Entities/Trip.cs
+++ b/uthTrip.DAL/Entities/Trip.cs
@@ -1,4 +1,4 @@
-namespace UthTrip.DAL.Entities
+namespace uthTrip.DAL.Entities
{
using System;
using System.Collections.Generic;
@@ -8,27 +8,28 @@ namespace UthTrip.DAL.Entities
public partial class Trip
{
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Trip()
{
- this.Reviews = new HashSet();
- this.Rights = new HashSet();
+ Reviews = new HashSet();
+ Rights = new HashSet();
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Trip_ID { get; set; }
- [StringLength(100)]
+ [StringLength(100,MinimumLength =10,ErrorMessage = "Title of trip shold have from 10 to 100 symbols")]
+ [Required]
public string Trip_Title { get; set; }
-
- [StringLength(300)]
+ [Required]
+ [StringLength(300, MinimumLength = 10, ErrorMessage = "Write some information about your trip")]
public string Description { get; set; }
-
+ [Required]
public double Price { get; set; }
public int Date_ID { get; set; }
-
+ [Required]
public int Number_Of_People { get; set; }
public int Destination_ID { get; set; }
@@ -36,13 +37,12 @@ public Trip()
public int Creator_ID { get; set; }
public virtual Dates_ranges Dates_ranges { get; set; }
-
public virtual Destination Destination { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Reviews { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Rights { get; set; }
public virtual User User { get; set; }
diff --git a/uthTrip.DAL/Entities/User.cs b/uthTrip.DAL/Entities/User.cs
index e6fd8ed..e957bd7 100644
--- a/uthTrip.DAL/Entities/User.cs
+++ b/uthTrip.DAL/Entities/User.cs
@@ -1,4 +1,4 @@
-namespace UthTrip.DAL.Entities
+namespace uthTrip.DAL.Entities
{
using System;
using System.Collections.Generic;
@@ -6,63 +6,71 @@ namespace UthTrip.DAL.Entities
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
+
public partial class User
{
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public User()
{
- this.Blocked_Users = new HashSet();
- this.Reviews = new HashSet();
- this.Rights = new HashSet();
- this.Trips = new HashSet();
+ Blocked_Users = new HashSet();
+ Reviews = new HashSet();
+ Rights = new HashSet();
+ Trips = new HashSet();
}
[Key]
- ////[DatabaseGenerated(DatabaseGeneratedOption.None)]
+
+ //[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int User_ID { get; set; }
[Required]
- [StringLength(30)]
+
+ [StringLength(30, MinimumLength = 3, ErrorMessage = "Name should be from 3 to 30 symbols")]
+
public string First_Name { get; set; }
[Required]
- [StringLength(30)]
+ [StringLength(30, MinimumLength = 2, ErrorMessage = "Surname should be from 2 to 30 symbols")]
public string Last_Name { get; set; }
[Required]
[StringLength(30)]
+ [RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}", ErrorMessage = "Email is invalid")]
public string Email { get; set; }
[Required]
- [StringLength(30)]
+ [StringLength(30, MinimumLength = 8, ErrorMessage = "Username should be from 8 to 50 symbols")]
public string Username { get; set; }
[Required]
- [StringLength(30)]
+ [StringLength(30, MinimumLength = 8, ErrorMessage = "Password should be from 8 to 50 symbols")]
+ [DataType(DataType.Password)]
+
public string Password { get; set; }
[Column(TypeName = "date")]
+ [DataType(DataType.Date)]
+
public DateTime Birthday { get; set; }
[Required]
[StringLength(30)]
public string Photo_Url { get; set; }
-
[Required]
[StringLength(30)]
public string Info { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Blocked_Users { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Reviews { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Rights { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection Trips { get; set; }
}
}
diff --git a/uthTrip.DAL/Interfaces/IRepository.cs b/uthTrip.DAL/Interfaces/IRepository.cs
index a330983..62e2dd0 100644
--- a/uthTrip.DAL/Interfaces/IRepository.cs
+++ b/uthTrip.DAL/Interfaces/IRepository.cs
@@ -1,28 +1,20 @@
-namespace UthTrip.DAL.Interfaces
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
- public interface IRepository
- where T : class
+namespace uthTrip.DAL.Interfaces
+{
+ public interface IRepository where T : class
{
IEnumerable GetAll();
-
T Get(int id);
-
T GetbyPass(string username, string password);
-
- IEnumerable Find(Func predicate);
-
+ IEnumerable Find(Func predicate);
void Create(T item);
-
void Update(T item);
-
void Delete(int id);
-
int MaxId();
}
}
diff --git a/uthTrip.DAL/Interfaces/IUnitOfWork.cs b/uthTrip.DAL/Interfaces/IUnitOfWork.cs
index fea75df..12948af 100644
--- a/uthTrip.DAL/Interfaces/IUnitOfWork.cs
+++ b/uthTrip.DAL/Interfaces/IUnitOfWork.cs
@@ -1,30 +1,22 @@
-namespace UthTrip.DAL.Interfaces
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+
+namespace uthTrip.DAL.Interfaces
{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.Entities;
-
public interface IUnitOfWork : IDisposable
{
IRepository Users { get; }
-
IRepository Trips { get; }
-
IRepository Roles { get; }
-
IRepository Rights { get; }
-
IRepository Reviews { get; }
-
IRepository Destinations { get; }
-
IRepository Dates_ranges { get; }
-
IRepository Blocked_Users { get; }
-
void Save();
}
}
diff --git a/uthTrip.DAL/Properties/AssemblyInfo.cs b/uthTrip.DAL/Properties/AssemblyInfo.cs
index b6db9d6..e5d7a43 100644
--- a/uthTrip.DAL/Properties/AssemblyInfo.cs
+++ b/uthTrip.DAL/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@
// 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("UthTrip.DAL")]
+[assembly: AssemblyTitle("uthTrip.DAL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UthTrip.DAL")]
+[assembly: AssemblyProduct("uthTrip.DAL")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/uthTrip.DAL/Repositories/BlockedUserRepository.cs b/uthTrip.DAL/Repositories/BlockedUserRepository.cs
index a14d902..21ade9f 100644
--- a/uthTrip.DAL/Repositories/BlockedUserRepository.cs
+++ b/uthTrip.DAL/Repositories/BlockedUserRepository.cs
@@ -1,71 +1,57 @@
-namespace UthTrip.DAL.Repositories
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+using System.Data.Entity;
+
+namespace uthTrip.DAL.Repositories
{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
-
public class BlockedUserRepository : IRepository
{
- private UthTripContext db;
-
- public BlockedUserRepository(UthTripContext context)
+ private uthtripContext db;
+ public int MaxId()
{
- this.db = context;
+ return 0;
}
-
- public int MaxId()
+ public BlockedUserRepository(uthtripContext context)
{
- int max = 0;
- try
- {
- max = this.db.Blocked_Users.Max(a => a.Blocked_ID);
- }
- catch (System.InvalidOperationException)
- {
- max = -1;
- }
-
- return max;
+ this.db = context;
}
public IEnumerable GetAll()
{
- return this.db.Blocked_Users;
+ return db.Blocked_Users;
}
public Blocked_Users Get(int id)
{
- return this.db.Blocked_Users.Find(id);
+ return db.Blocked_Users.Find(id);
}
public void Create(Blocked_Users user)
{
- this.db.Blocked_Users.Add(user);
+ db.Blocked_Users.Add(user);
}
public void Update(Blocked_Users user)
{
- ////this.db.Entry(user).State = EntityState.Modified;
+ db.Entry(user).State = EntityState.Modified;
}
- public IEnumerable Find(Func predicate)
+ public IEnumerable Find(Func predicate)
{
- return this.db.Blocked_Users.Where(predicate).ToList();
+ return db.Blocked_Users.Where(predicate).ToList();
}
public void Delete(int id)
{
- Blocked_Users user = this.db.Blocked_Users.Find(id);
+ Blocked_Users user = db.Blocked_Users.Find(id);
if (user != null)
- {
- this.db.Blocked_Users.Remove(user);
- }
+ db.Blocked_Users.Remove(user);
}
public Blocked_Users GetbyPass(string username, string password)
diff --git a/uthTrip.DAL/Repositories/DateRangeRepository.cs b/uthTrip.DAL/Repositories/DateRangeRepository.cs
index d032391..002d381 100644
--- a/uthTrip.DAL/Repositories/DateRangeRepository.cs
+++ b/uthTrip.DAL/Repositories/DateRangeRepository.cs
@@ -1,71 +1,64 @@
-namespace UthTrip.DAL.Repositories
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+using System.Data.Entity;
+namespace uthTrip.DAL.Repositories
+{
public class DateRangeRepository : IRepository
{
- private UthTripContext db;
-
- public DateRangeRepository(UthTripContext context)
- {
- this.db = context;
- }
-
+ private uthtripContext db;
public int MaxId()
{
int max = 0;
try
{
- max = this.db.Dates_ranges.Max(a => a.Date_ID);
+ max = db.Dates_ranges.Max(a => a.Date_ID);
}
catch (System.InvalidOperationException)
- {
- max = -1;
- }
-
+ { max = -1; }
return max;
}
+ public DateRangeRepository(uthtripContext context)
+ {
+ this.db = context;
+ }
public IEnumerable GetAll()
{
- return this.db.Dates_ranges;
+ return db.Dates_ranges;
}
public Dates_ranges Get(int id)
{
- return this.db.Dates_ranges.Find(id);
+ return db.Dates_ranges.Find(id);
}
public void Create(Dates_ranges dates_range)
{
- this.db.Dates_ranges.Add(dates_range);
+ db.Dates_ranges.Add(dates_range);
}
public void Update(Dates_ranges dates_range)
{
- ////this.db.Entry(dates_range).State = EntityState.Modified;
+ db.Entry(dates_range).State = EntityState.Modified;
}
- public IEnumerable Find(Func predicate)
+ public IEnumerable Find(Func predicate)
{
- return this.db.Dates_ranges.Where(predicate).ToList();
+ return db.Dates_ranges.Where(predicate).ToList();
}
public void Delete(int id)
{
- Dates_ranges dates_range = this.db.Dates_ranges.Find(id);
+ Dates_ranges dates_range = db.Dates_ranges.Find(id);
if (dates_range != null)
- {
- this.db.Dates_ranges.Remove(dates_range);
- }
+ db.Dates_ranges.Remove(dates_range);
}
public Dates_ranges GetbyPass(string username, string password)
diff --git a/uthTrip.DAL/Repositories/DestinationRepository.cs b/uthTrip.DAL/Repositories/DestinationRepository.cs
index 37c532a..0c4ea80 100644
--- a/uthTrip.DAL/Repositories/DestinationRepository.cs
+++ b/uthTrip.DAL/Repositories/DestinationRepository.cs
@@ -1,71 +1,65 @@
-namespace UthTrip.DAL.Repositories
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+using System.Data.Entity;
+namespace uthTrip.DAL.Repositories
+{
public class DestinationRepository : IRepository
{
- private UthTripContext db;
-
- public DestinationRepository(UthTripContext context)
- {
- this.db = context;
- }
-
+ private uthtripContext db;
public int MaxId()
{
int max;
try
{
- max = this.db.Destinations.Max(a => a.Destination_ID);
+ max = db.Destinations.Max(a => a.Destination_ID);
+
}
catch (System.InvalidOperationException)
- {
- max = -1;
- }
-
+ { max = -1; }
return max;
}
+ public DestinationRepository(uthtripContext context)
+ {
+ this.db = context;
+ }
public IEnumerable GetAll()
{
- return this.db.Destinations;
+ return db.Destinations;
}
public Destination Get(int id)
{
- return this.db.Destinations.Find(id);
+ return db.Destinations.Find(id);
}
public void Create(Destination destination)
{
- this.db.Destinations.Add(destination);
+ db.Destinations.Add(destination);
}
public void Update(Destination destination)
{
- ////this.db.Entry(destination).State = EntityState.Modified;
+ db.Entry(destination).State = EntityState.Modified;
}
- public IEnumerable Find(Func predicate)
+ public IEnumerable Find(Func predicate)
{
- return this.db.Destinations.Where(predicate).ToList();
+ return db.Destinations.Where(predicate).ToList();
}
public void Delete(int id)
{
- Destination destination = this.db.Destinations.Find(id);
+ Destination destination = db.Destinations.Find(id);
if (destination != null)
- {
- this.db.Destinations.Remove(destination);
- }
+ db.Destinations.Remove(destination);
}
public Destination GetbyPass(string username, string password)
diff --git a/uthTrip.DAL/Repositories/EFUnitOfWork.cs b/uthTrip.DAL/Repositories/EFUnitOfWork.cs
index b1c1c87..7da1a21 100644
--- a/uthTrip.DAL/Repositories/EFUnitOfWork.cs
+++ b/uthTrip.DAL/Repositories/EFUnitOfWork.cs
@@ -1,18 +1,18 @@
-namespace UthTrip.DAL.Repositories
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+using uthTrip.DAL.Entities;
+
+namespace uthTrip.DAL.Repositories
{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
-
public class EFUnitOfWork : IUnitOfWork
{
- private UthTripContext db;
+ private uthtripContext db;
private UserRepository userRepository;
private TripRepository tripRepository;
private ReviewRepository reviewRepository;
@@ -21,36 +21,18 @@ public class EFUnitOfWork : IUnitOfWork
private DestinationRepository destinationRepository;
private RoleRepository roleRepository;
private RightRepository rightRepository;
- private bool disposed = false;
public EFUnitOfWork(string connectionString)
{
- this.db = new UthTripContext(connectionString);
- }
-
- public EFUnitOfWork(UthTripContext db)
- {
- this.db = db;
- this.userRepository = new UserRepository(db);
- this.tripRepository = new TripRepository(db);
- this.reviewRepository = new ReviewRepository(db);
- this.blockedUserRepository = new BlockedUserRepository(db);
- this.dateRangeRepository = new DateRangeRepository(db);
- this.destinationRepository = new DestinationRepository(db);
- this.roleRepository = new RoleRepository(db);
- this.rightRepository = new RightRepository(db);
+ db = new uthtripContext(connectionString);
}
-
public IRepository Users
{
get
{
- if (this.userRepository == null)
- {
- this.userRepository = new UserRepository(this.db);
- }
-
- return this.userRepository;
+ if (userRepository == null)
+ userRepository = new UserRepository(db);
+ return userRepository;
}
}
@@ -58,115 +40,101 @@ public IRepository Trips
{
get
{
- if (this.tripRepository == null)
- {
- this.tripRepository = new TripRepository(this.db);
- }
-
- return this.tripRepository;
+ if (tripRepository == null)
+ tripRepository = new TripRepository(db);
+ return tripRepository;
}
}
-
public IRepository Reviews
{
get
{
- if (this.reviewRepository == null)
- {
- this.reviewRepository = new ReviewRepository(this.db);
- }
-
- return this.reviewRepository;
+ if (reviewRepository == null)
+ reviewRepository = new ReviewRepository(db);
+ return reviewRepository;
}
}
-
public IRepository Blocked_Users
{
get
{
- if (this.blockedUserRepository == null)
- {
- this.blockedUserRepository = new BlockedUserRepository(this.db);
- }
-
- return this.blockedUserRepository;
+ if (blockedUserRepository == null)
+ blockedUserRepository = new BlockedUserRepository(db);
+ return blockedUserRepository;
}
}
-
public IRepository Dates_ranges
{
get
{
- if (this.dateRangeRepository == null)
- {
- this.dateRangeRepository = new DateRangeRepository(this.db);
- }
-
- return this.dateRangeRepository;
+ if (dateRangeRepository == null)
+ dateRangeRepository = new DateRangeRepository(db);
+ return dateRangeRepository;
}
}
-
public IRepository Destinations
{
get
{
- if (this.destinationRepository == null)
- {
- this.destinationRepository = new DestinationRepository(this.db);
- }
-
- return this.destinationRepository;
+ if (destinationRepository == null)
+ destinationRepository = new DestinationRepository(db);
+ return destinationRepository;
}
}
-
public IRepository Roles
{
get
{
- if (this.roleRepository == null)
- {
- this.roleRepository = new RoleRepository(this.db);
- }
-
- return this.roleRepository;
+ if (roleRepository == null)
+ roleRepository = new RoleRepository(db);
+ return roleRepository;
}
}
-
public IRepository Rights
{
get
{
- if (this.rightRepository == null)
- {
- this.rightRepository = new RightRepository(this.db);
- }
-
- return this.rightRepository;
+ if (rightRepository == null)
+ rightRepository = new RightRepository(db);
+ return rightRepository;
}
}
-
public void Save()
{
- this.db.SaveChanges();
+ db.SaveChanges();
}
+ private bool disposed = false;
+
public virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
- this.db.Dispose();
+ db.Dispose();
}
-
this.disposed = true;
}
}
public void Dispose()
{
- this.Dispose(true);
+ Dispose(true);
GC.SuppressFinalize(this);
}
+ public EFUnitOfWork(uthtripContext db)
+ {
+ this.db = db;
+ userRepository = new UserRepository(db);
+ tripRepository = new TripRepository(db);
+ reviewRepository = new ReviewRepository(db);
+ blockedUserRepository = new BlockedUserRepository(db);
+ dateRangeRepository = new DateRangeRepository(db);
+ destinationRepository = new DestinationRepository(db);
+ roleRepository = new RoleRepository(db);
+ rightRepository = new RightRepository(db);
+
+ }
}
}
\ No newline at end of file
diff --git a/uthTrip.DAL/Repositories/ReviewRepository.cs b/uthTrip.DAL/Repositories/ReviewRepository.cs
index 9b7c0e5..a294fe0 100644
--- a/uthTrip.DAL/Repositories/ReviewRepository.cs
+++ b/uthTrip.DAL/Repositories/ReviewRepository.cs
@@ -1,70 +1,57 @@
-namespace UthTrip.DAL.Repositories
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+using System.Data.Entity;
+
+namespace uthTrip.DAL.Repositories
{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
-
public class ReviewRepository : IRepository
{
- private UthTripContext db;
-
- public ReviewRepository(UthTripContext context)
+ private uthtripContext db;
+ public int MaxId()
{
- this.db = context;
+ return 0;
}
-
- public int MaxId()
+ public ReviewRepository(uthtripContext context)
{
- int max;
- try
- {
- max = this.db.Reviews.Max(a => a.Review_ID);
- }
- catch (System.InvalidOperationException)
- {
- max = -1;
- }
- return max;
+ this.db = context;
}
public IEnumerable GetAll()
{
- return this.db.Reviews;
+ return db.Reviews;
}
public Review Get(int id)
{
- return this.db.Reviews.Find(id);
+ return db.Reviews.Find(id);
}
public void Create(Review review)
{
- this.db.Reviews.Add(review);
+ db.Reviews.Add(review);
}
public void Update(Review review)
{
- ////this.db.Entry(review).State = EntityState.Modified;
+ db.Entry(review).State = EntityState.Modified;
}
- public IEnumerable Find(Func predicate)
+ public IEnumerable Find(Func predicate)
{
- return this.db.Reviews.Where(predicate).ToList();
+ return db.Reviews.Where(predicate).ToList();
}
public void Delete(int id)
{
- Review review = this.db.Reviews.Find(id);
+ Review review = db.Reviews.Find(id);
if (review != null)
- {
- this.db.Reviews.Remove(review);
- }
+ db.Reviews.Remove(review);
}
public Review GetbyPass(string username, string password)
diff --git a/uthTrip.DAL/Repositories/RightRepository.cs b/uthTrip.DAL/Repositories/RightRepository.cs
index 7ea33df..1568729 100644
--- a/uthTrip.DAL/Repositories/RightRepository.cs
+++ b/uthTrip.DAL/Repositories/RightRepository.cs
@@ -1,70 +1,64 @@
-namespace UthTrip.DAL.Repositories
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+using System.Data.Entity;
+namespace uthTrip.DAL.Repositories
+{
public class RightRepository : IRepository
{
- private UthTripContext db;
-
- public RightRepository(UthTripContext context)
- {
- this.db = context;
- }
-
+ private uthtripContext db;
public int MaxId()
{
int max;
try
{
- max = this.db.Rights.Max(a => a.Rights_ID);
+ max = db.Rights.Max(a => a.Rights_ID);
}
catch (System.InvalidOperationException)
- {
- max = -1;
- }
+ { max = -1; }
return max;
}
+ public RightRepository(uthtripContext context)
+ {
+ this.db = context;
+ }
public IEnumerable GetAll()
{
- return this.db.Rights;
+ return db.Rights;
}
public Right Get(int id)
{
- return this.db.Rights.Find(id);
+ return db.Rights.Find(id);
}
public void Create(Right right)
{
- this.db.Rights.Add(right);
+ db.Rights.Add(right);
}
public void Update(Right right)
{
- ////this.db.Entry(right).State = EntityState.Modified;
+ db.Entry(right).State = EntityState.Modified;
}
- public IEnumerable Find(Func predicate)
+ public IEnumerable Find(Func predicate)
{
- return this.db.Rights.Where(predicate).ToList();
+ return db.Rights.Where(predicate).ToList();
}
public void Delete(int id)
{
- Right right = this.db.Rights.Find(id);
+ Right right = db.Rights.Find(id);
if (right != null)
- {
- this.db.Rights.Remove(right);
- }
+ db.Rights.Remove(right);
}
public Right GetbyPass(string username, string password)
diff --git a/uthTrip.DAL/Repositories/RoleRepository.cs b/uthTrip.DAL/Repositories/RoleRepository.cs
index 139eab9..785a03e 100644
--- a/uthTrip.DAL/Repositories/RoleRepository.cs
+++ b/uthTrip.DAL/Repositories/RoleRepository.cs
@@ -1,70 +1,64 @@
-namespace UthTrip.DAL.Repositories
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+using System.Data.Entity;
+namespace uthTrip.DAL.Repositories
+{
public class RoleRepository : IRepository
{
- private UthTripContext db;
-
- public RoleRepository(UthTripContext context)
- {
- this.db = context;
- }
-
+ private uthtripContext db;
public int MaxId()
{
int max;
try
{
- max = this.db.Roles.Max(a => a.Role_ID);
+ max = db.Roles.Max(a => a.Role_ID);
}
catch (System.InvalidOperationException)
- {
- max = -1;
- }
+ { max = -1; }
return max;
}
+ public RoleRepository(uthtripContext context)
+ {
+ this.db = context;
+ }
public IEnumerable GetAll()
{
- return this.db.Roles;
+ return db.Roles;
}
public Role Get(int id)
{
- return this.db.Roles.Find(id);
+ return db.Roles.Find(id);
}
public void Create(Role role)
{
- this.db.Roles.Add(role);
+ db.Roles.Add(role);
}
public void Update(Role role)
{
- ////this.db.Entry(role).State = EntityState.Modified;
+ db.Entry(role).State = EntityState.Modified;
}
- public IEnumerable Find(Func predicate)
+ public IEnumerable Find(Func predicate)
{
- return this.db.Roles.Where(predicate).ToList();
+ return db.Roles.Where(predicate).ToList();
}
public void Delete(int id)
{
- Role role = this.db.Roles.Find(id);
+ Role role = db.Roles.Find(id);
if (role != null)
- {
- this.db.Roles.Remove(role);
- }
+ db.Roles.Remove(role);
}
public Role GetbyPass(string username, string password)
diff --git a/uthTrip.DAL/Repositories/TripRepository.cs b/uthTrip.DAL/Repositories/TripRepository.cs
index 725e517..374a659 100644
--- a/uthTrip.DAL/Repositories/TripRepository.cs
+++ b/uthTrip.DAL/Repositories/TripRepository.cs
@@ -1,73 +1,64 @@
-////using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+using System.Data.Entity;
-namespace UthTrip.DAL.Repositories
+namespace uthTrip.DAL.Repositories
{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
-
public class TripRepository : IRepository
{
- private UthTripContext db;
-
- public TripRepository(UthTripContext context)
- {
- this.db = context;
- }
-
+ private uthtripContext db;
public int MaxId()
{
int max;
try
{
- max = this.db.Trips.Max(a => a.Trip_ID);
- }
- catch (System.InvalidOperationException)
- {
- max = -1;
+ max = db.Trips.Max(a => a.Trip_ID);
}
-
+ catch(System.InvalidOperationException)
+ { max = -1; }
return max;
}
+ public TripRepository(uthtripContext context)
+ {
+ this.db = context;
+ }
public IEnumerable GetAll()
{
- return this.db.Trips;
+ return db.Trips;
}
public Trip Get(int id)
{
- return this.db.Trips.Find(id);
+ return db.Trips.Find(id);
}
public void Create(Trip trip)
{
- this.db.Trips.Add(trip);
+ db.Trips.Add(trip);
}
public void Update(Trip trip)
{
- this.db.Entry(trip).State = EntityState.Modified;
+ db.Entry(trip).State = EntityState.Modified;
}
- public IEnumerable Find(Func predicate)
+ public IEnumerable Find(Func predicate)
{
- return this.db.Trips.Where(predicate).ToList();
+ return db.Trips.Where(predicate).ToList();
}
public void Delete(int id)
{
- Trip trip = this.db.Trips.Find(id);
+ Trip trip = db.Trips.Find(id);
if (trip != null)
- {
- this.db.Trips.Remove(trip);
- }
+ db.Trips.Remove(trip);
}
public Trip GetbyPass(string username, string password)
diff --git a/uthTrip.DAL/Repositories/UserRepository.cs b/uthTrip.DAL/Repositories/UserRepository.cs
index 065ce82..4c632dd 100644
--- a/uthTrip.DAL/Repositories/UserRepository.cs
+++ b/uthTrip.DAL/Repositories/UserRepository.cs
@@ -1,77 +1,89 @@
-////using Microsoft.EntityFrameworkCore;
-namespace UthTrip.DAL.Repositories
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UthTrip.DAL.EF;
- using UthTrip.DAL.Entities;
- using UthTrip.DAL.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using uthTrip.DAL.Entities;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Interfaces;
+<<<<<<< Updated upstream
+using System.Data.Entity;
+=======
+//using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.AspNetCore.Mvc.ModelBinding;
+>>>>>>> Stashed changes
+namespace uthTrip.DAL.Repositories
+{
public class UserRepository : IRepository
{
- private UthTripContext db;
+ private uthtripContext db;
- public UserRepository(UthTripContext context)
+ public UserRepository(uthtripContext context)
{
this.db = context;
}
public IEnumerable GetAll()
{
- return this.db.Users;
+ return db.Users;
}
public User Get(int id)
{
- return this.db.Users.Find(id);
+ return db.Users.Find(id);
}
- public void Create(User user)
+ public void Create( User user)
{
- this.db.Users.Add(user);
+ db.Users.Add(user);
}
public void Update(User user)
{
- this.db.Entry(user).State = EntityState.Modified;
+ db.Entry(user).State = EntityState.Modified;
}
- public IEnumerable Find(Func predicate)
+ public IEnumerable Find(Func predicate)
{
- return this.db.Users.Where(predicate).ToList();
+ return db.Users.Where(predicate).ToList();
}
public void Delete(int id)
{
- User user = this.db.Users.Find(id);
+ User user = db.Users.Find(id);
if (user != null)
- {
- this.db.Users.Remove(user);
- }
+ db.Users.Remove(user);
}
-
public int MaxId()
{
+<<<<<<< Updated upstream
int max = 0;
try
{
- max = this.db.Users.Max(a => a.User_ID);
+ max = db.Users.Max(a => a.User_ID);
}
- catch (System.InvalidOperationException)
- {
- max = -1;
- }
-
+ catch(System.InvalidOperationException)
+ { max= -1; }
return max;
+=======
+ //int max = 0;
+ //try
+ //{
+ // max = db.Users.Max(a => a.User_ID);
+ //}
+ //catch (System.InvalidOperationException)
+ //{ max = -1; }
+ return -1;
+>>>>>>> Stashed changes
+
}
public User GetbyPass(string username, string password)
{
- return this.db.Users.Where(a => a.Username == username && a.Password == password).ToList().FirstOrDefault();
+ return db.Users.Where(a => a.Username == username && a.Password==password).ToList().FirstOrDefault();
}
}
}
diff --git a/uthTrip.DAL/packages.config b/uthTrip.DAL/packages.config
index fe7b730..49f8b92 100644
--- a/uthTrip.DAL/packages.config
+++ b/uthTrip.DAL/packages.config
@@ -1,8 +1,58 @@
+<<<<<<< Updated upstream
+=======
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13,17 +63,76 @@
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>>>>>>> Stashed changes
\ No newline at end of file
diff --git a/uthTrip.DAL/uthTrip.DAL.csproj b/uthTrip.DAL/uthTrip.DAL.csproj
index 5362124..d4ae701 100644
--- a/uthTrip.DAL/uthTrip.DAL.csproj
+++ b/uthTrip.DAL/uthTrip.DAL.csproj
@@ -1,5 +1,8 @@
+
+
+
@@ -40,12 +43,144 @@
..\packages\EntityFramework.6.3.0\lib\net45\EntityFramework.SqlServer.dll
+<<<<<<< Updated upstream
+
+=======
+
+ ..\packages\Microsoft.AspNetCore.Antiforgery.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Antiforgery.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Authentication.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Authentication.Core.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Core.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Authorization.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authorization.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Authorization.Policy.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authorization.Policy.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Cors.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Cors.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Cryptography.Internal.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Cryptography.Internal.dll
+
+
+ ..\packages\Microsoft.AspNetCore.DataProtection.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.DataProtection.dll
+
+
+ ..\packages\Microsoft.AspNetCore.DataProtection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.DataProtection.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Diagnostics.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Diagnostics.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Hosting.Server.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Server.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Html.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Html.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Http.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Http.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Http.Extensions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Extensions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Http.Features.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll
+
+
+ ..\packages\Microsoft.AspNetCore.JsonPatch.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.JsonPatch.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Localization.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Localization.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.ApiExplorer.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.ApiExplorer.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.Core.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.Cors.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Cors.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.DataAnnotations.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.DataAnnotations.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.Formatters.Json.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Formatters.Json.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.Localization.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Localization.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.Razor.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.Razor.Extensions.2.2.0\lib\net46\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.RazorPages.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.RazorPages.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.TagHelpers.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.TagHelpers.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Mvc.ViewFeatures.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.ViewFeatures.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Razor.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Razor.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Razor.Language.2.2.0\lib\net46\Microsoft.AspNetCore.Razor.Language.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Razor.Runtime.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Razor.Runtime.dll
+
+
+ ..\packages\Microsoft.AspNetCore.ResponseCaching.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.ResponseCaching.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Routing.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Routing.dll
+
+
+ ..\packages\Microsoft.AspNetCore.Routing.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Routing.Abstractions.dll
+
+
+ ..\packages\Microsoft.AspNetCore.WebUtilities.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll
+
..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0-preview3.19551.4\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
..\packages\Microsoft.Bcl.HashCode.1.1.0-preview3.19551.4\lib\net461\Microsoft.Bcl.HashCode.dll
+
+ ..\packages\Microsoft.CodeAnalysis.Common.2.8.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.2.8.0\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Razor.2.2.0\lib\net46\Microsoft.CodeAnalysis.Razor.dll
+
+
+ ..\packages\Microsoft.DotNet.PlatformAbstractions.2.1.0\lib\net45\Microsoft.DotNet.PlatformAbstractions.dll
+
..\packages\Microsoft.EntityFrameworkCore.3.1.0-preview3.19554.8\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll
@@ -73,21 +208,65 @@
..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
+
+ ..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.dll
+
+
+ ..\packages\Microsoft.Extensions.FileProviders.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll
+
+
+ ..\packages\Microsoft.Extensions.FileProviders.Composite.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Composite.dll
+
+
+ ..\packages\Microsoft.Extensions.FileSystemGlobbing.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileSystemGlobbing.dll
+
+
+ ..\packages\Microsoft.Extensions.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll
+
+
+ ..\packages\Microsoft.Extensions.Localization.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Localization.dll
+
+
+ ..\packages\Microsoft.Extensions.Localization.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Localization.Abstractions.dll
+
..\packages\Microsoft.Extensions.Logging.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Logging.dll
..\packages\Microsoft.Extensions.Logging.Abstractions.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll
+
+ ..\packages\Microsoft.Extensions.ObjectPool.2.2.0\lib\netstandard2.0\Microsoft.Extensions.ObjectPool.dll
+
..\packages\Microsoft.Extensions.Options.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Options.dll
..\packages\Microsoft.Extensions.Primitives.3.1.0-preview3.19553.2\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll
+
+ ..\packages\Microsoft.Extensions.WebEncoders.2.2.0\lib\netstandard2.0\Microsoft.Extensions.WebEncoders.dll
+
+
+ ..\packages\Microsoft.Net.Http.Headers.2.2.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll
+
+
+ ..\packages\Microsoft.Win32.Registry.4.5.0\lib\net461\Microsoft.Win32.Registry.dll
+
+
+ ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\Newtonsoft.Json.Bson.1.0.1\lib\net45\Newtonsoft.Json.Bson.dll
+
-
- ..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll
+
+ ..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll
+ True
+ True
+
+
+ ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll
..\packages\System.Collections.Immutable.1.7.0-preview3.19551.4\lib\netstandard2.0\System.Collections.Immutable.dll
@@ -95,32 +274,185 @@
..\packages\System.ComponentModel.Annotations.4.7.0-preview3.19551.4\lib\net461\System.ComponentModel.Annotations.dll
+
+>>>>>>> Stashed changes
+
+ ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll
+ True
+ True
+
+<<<<<<< Updated upstream
+
+
+=======
+
..\packages\System.Diagnostics.DiagnosticSource.4.7.0-preview3.19551.4\lib\net46\System.Diagnostics.DiagnosticSource.dll
+
+ ..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll
+ True
+ True
+
+
+ ..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll
+ True
+ True
+
+
+
+ ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll
+ True
+ True
+
+
+ ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll
+ True
+ True
+
+
+ ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll
+ True
+ True
+
+
+ ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll
+ True
+ True
+
+
+ ..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll
+ True
+ True
+
+
+ ..\packages\System.Linq.Expressions.4.3.0\lib\net463\System.Linq.Expressions.dll
+ True
+ True
+
..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll
+
..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll
+
+ ..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll
+ True
+ True
+
+
+ ..\packages\System.Reflection.Metadata.1.4.2\lib\portable-net45+win8\System.Reflection.Metadata.dll
+
+
+ ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll
+ True
+ True
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.7.0-preview3.19551.4\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
+
+ ..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll
+ True
+ True
+
+
+ ..\packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll
+ True
+ True
+
+
+ ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll
+ True
+ True
+
+
+ ..\packages\System.Security.AccessControl.4.5.0\lib\net461\System.Security.AccessControl.dll
+
+
+ ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll
+ True
+ True
+
+
+ ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll
+ True
+ True
+
+
+ ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll
+ True
+ True
+
+
+ ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll
+ True
+ True
+
+
+ ..\packages\System.Security.Cryptography.Xml.4.5.0\lib\net461\System.Security.Cryptography.Xml.dll
+
+
+ ..\packages\System.Security.Permissions.4.5.0\lib\net461\System.Security.Permissions.dll
+
+
+ ..\packages\System.Security.Principal.Windows.4.5.0\lib\net461\System.Security.Principal.Windows.dll
+
+
+
+ ..\packages\System.Text.Encoding.CodePages.4.3.0\lib\net46\System.Text.Encoding.CodePages.dll
+
+
+ ..\packages\System.Text.Encodings.Web.4.5.0\lib\netstandard2.0\System.Text.Encodings.Web.dll
+
..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll
+
+ ..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll
+ True
+ True
+
+
+
+ ..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll
+ True
+ True
+
+>>>>>>> Stashed changes
+
+ ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll
+ True
+ True
+
+
+ ..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll
+ True
+ True
+
+
+ ..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll
+ True
+ True
+
+
+ ..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll
+ True
+ True
+
@@ -147,8 +479,8 @@
-
-
+
+
@@ -163,6 +495,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/uthTrip.Tests/App.config b/uthTrip.Tests/App.config
index a7fe939..b5dfb58 100644
--- a/uthTrip.Tests/App.config
+++ b/uthTrip.Tests/App.config
@@ -47,6 +47,130 @@
+
+<<<<<<< Updated upstream
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+=======
+>>>>>>> Stashed changes
+
+
+
+
+
+
+
+
+<<<<<<< Updated upstream
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+=======
+
+
+>>>>>>> Stashed changes
+
\ No newline at end of file
diff --git a/uthTrip.Tests/Properties/AssemblyInfo.cs b/uthTrip.Tests/Properties/AssemblyInfo.cs
index 89c10a4..bd47e29 100644
--- a/uthTrip.Tests/Properties/AssemblyInfo.cs
+++ b/uthTrip.Tests/Properties/AssemblyInfo.cs
@@ -2,11 +2,11 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-[assembly: AssemblyTitle("UthTrip.Tests")]
+[assembly: AssemblyTitle("uthTrip.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UthTrip.Tests")]
+[assembly: AssemblyProduct("uthTrip.Tests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/uthTrip.Tests/UnitTest1.cs b/uthTrip.Tests/UnitTest1.cs
index a45eebc..774cff5 100644
--- a/uthTrip.Tests/UnitTest1.cs
+++ b/uthTrip.Tests/UnitTest1.cs
@@ -1,157 +1,332 @@
using System;
+<<<<<<< Updated upstream
using System.Collections.Generic;
using System.Linq;
using System.Web;
-//using NUnit.Framework;
-using UthTrip.BLL.Services;
-using UthTrip.BLL.Interfaces;
-using UthTripProject.Models;
-using UthTrip.DAL.Interfaces;
+using NUnit.Framework;
+using uthTrip.BLL.Services;
+using uthTrip.BLL.Interfaces;
+using uthTripProject.Models;
+using uthTrip.DAL.Interfaces;
+using uthTrip.DAL.EF;
+using uthTrip.DAL.Repositories;
+using uthTrip.BLL.DTO;
+using uthTrip.BLL.Infrastructure;
+
+
+namespace uthTrip.Tests
+{
+ public class UnitTest1
+ {
+ readonly string testConnectionString = "Initial Catalog=UthTripDB;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
+ UserService CreateUserService()
+ {
+ return new UserService(
+ new EFUnitOfWork(
+ new uthtripContext(testConnectionString)
+ )
+ );
+ }
+
+ [TearDown]
+ public void ClearDB()
+ {
+ var context = new uthtripContext(testConnectionString);
+ context.Users.RemoveRange(context.Users);
+ context.SaveChanges();
+ }
+
+ [Test]
+ public void CreateTest()
+ {
+ var userService = CreateUserService();
+
+ DateTime somedate = new DateTime(2000, 07, 21);
+
+ UserDTO usermodel = new UserDTO();
+ usermodel.User_ID = 2;
+ usermodel.First_Name = "Nadia";
+ usermodel.Last_Name = "Padalka";
+ usermodel.Email = "nadiapadalka@gmail.com";
+ usermodel.Username = "nadiapadalka";
+ usermodel.Password = "1111";
+ usermodel.Birthday = somedate;
+ usermodel.Photo_Url = "www";
+ usermodel.Info = "super girl";
+ userService.CreateUser(usermodel);
+
+ var user = userService.GetAll().SingleOrDefault();
+ Assert.AreEqual("Nadia", user.First_Name);
+ }
+
+ [Test]
+ public void DeleteUser()
+ {
+ var userService = CreateUserService();
+
+ DateTime somedate = new DateTime(2000, 07, 21);
+
+ UserDTO usermodel = new UserDTO();
+ usermodel.User_ID = 2;
+ usermodel.First_Name = "Nadia";
+ usermodel.Last_Name = "Padalka";
+ usermodel.Email = "nadiapadalka@gmail.com";
+ usermodel.Username = "nadiapadalka";
+ usermodel.Password = "1111";
+ usermodel.Birthday = somedate;
+ usermodel.Photo_Url = "www";
+ usermodel.Info = "super girl";
+ userService.CreateUser(usermodel);
+
+ var user = userService.GetAll().SingleOrDefault();
+
+ userService.Dispose(user.User_ID);
+ Assert.AreEqual(0, userService.GetAll().Count());
+ }
+
+
+
+ [Test]
+ public void GetByIdTest()
+ {
+ var userService = CreateUserService();
+
+ DateTime somedate = new DateTime(2000, 07, 21);
+
+ UserDTO usermodel = new UserDTO();
+ usermodel.User_ID = 2;
+ usermodel.First_Name = "Nadia";
+ usermodel.Last_Name = "Padalka";
+ usermodel.Email = "nadiapadalka@gmail.com";
+ usermodel.Username = "nadiapadalka";
+ usermodel.Password = "1111";
+ usermodel.Birthday = somedate;
+ usermodel.Photo_Url = "www";
+ usermodel.Info = "super girl";
+ userService.CreateUser(usermodel);
+ var user = userService.GetAll().FirstOrDefault();
+ Assert.NotNull(userService.GetById(user.User_ID));
+ }
+
+ [Test]
+ public void GetAll()
+ {
+ var userService = CreateUserService();
+
+ DateTime somedate = new DateTime(2000, 07, 21);
+
+ UserDTO usermodel = new UserDTO();
+ usermodel.User_ID = 2;
+ usermodel.First_Name = "Nadia";
+ usermodel.Last_Name = "Padalka";
+ usermodel.Email = "nadiapadalka@gmail.com";
+ usermodel.Username = "nadiapadalka";
+ usermodel.Password = "1111";
+ usermodel.Birthday = somedate;
+ usermodel.Photo_Url = "www";
+ usermodel.Info = "super girl";
+ userService.CreateUser(usermodel);
+ UserDTO user1 = new UserDTO(3, "Marichka", "Dymyd", "mariia@gmail.com", "mariicka", "1212", somedate, "www", "giirl");
+ userService.CreateUser(user1);
+
+ Assert.AreEqual(2, userService.GetAll().Count());
+ }
+=======
+using Xunit;
using UthTrip.DAL.EF;
+using UthTrip.DAL.Entities;
+using System.Collections.Generic;
using UthTrip.DAL.Repositories;
+using Moq;
using UthTrip.BLL.DTO;
-using UthTrip.DAL.Entities;
-using UthTrip.BLL.Infrastructure;
-using UthTripProject.Controllers;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Web.Mvc;
+using System.Data.Entity;
+using System.Linq;
+using Effort;
+using UthTrip.BLL.Services;
+using System.Data;
+using System.Data.Common;
+namespace UnitTestProject1
+{
-using Moq;
+ public class UserServiceTest : IDisposable
+ {
+ DbConnection connection;
+ UthTripContext databaseContext;
-namespace UthTrip.Tests
-{
- // [TestClass]
- // public class UnitTest1
- // {
- // readonly string testConnectionString = "Initial Catalog=UthTripDB;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
- // UserService CreateUserService()
- // {
- // return new UserService(
- // new EFUnitOfWork(
- // new UthTripContext(testConnectionString)
- // )
- // );
- // }
-
- // //[TearDown]
- // //public void ClearDB()
- // //{
- // // var context = new UthTripContext(testConnectionString);
- // // context.Users.RemoveRange(context.Users);
- // // context.SaveChanges();
- // //}
-
- // //[Test]
- // //public void CreateTest()
- // //{
- // // var userService = CreateUserService();
-
- // // DateTime somedate = new DateTime(2000, 07, 21);
-
- // // UserDTO usermodel = new UserDTO();
- // // usermodel.User_ID = 2;
- // // usermodel.First_Name = "Nadia";
- // // usermodel.Last_Name = "Padalka";
- // // usermodel.Email = "nadiapadalka@gmail.com";
- // // usermodel.Username = "nadiapadalka";
- // // usermodel.Password = "1111";
- // // usermodel.Birthday = somedate;
- // // usermodel.Photo_Url = "www";
- // // usermodel.Info = "super girl";
- // // userService.CreateUser(usermodel);
-
- // // var user = userService.GetAll().SingleOrDefault();
- // // Assert.AreEqual("Nadia", user.First_Name);
- // //}
- // [TestMethod]
- // public void Sum_Products_Correctly()
- // {
- // // Arrange (добавляем имитированный объект)
- // Mock mock = new Mock();
- // mock.Setup(m => m.GetAll());
-
- // UserController controller = new UserController(mock.Object);
- // //string expected = "В базе данных 1 объект";
-
- // // Act
-
- // ViewResult result = controller.Index() as ViewResult;
- // string actual = result.ViewBag.Message as string;
-
- // // Assert
- // Assert.IsNotNull(result.Model);
- // }
- // //[Test]
- // //public void DeleteUser()
- // //{
- // // var userService = CreateUserService();
-
- // // DateTime somedate = new DateTime(2000, 07, 21);
-
- // // UserDTO usermodel = new UserDTO();
- // // usermodel.User_ID = 2;
- // // usermodel.First_Name = "Nadia";
- // // usermodel.Last_Name = "Padalka";
- // // usermodel.Email = "nadiapadalka@gmail.com";
- // // usermodel.Username = "nadiapadalka";
- // // usermodel.Password = "1111";
- // // usermodel.Birthday = somedate;
- // // usermodel.Photo_Url = "www";
- // // usermodel.Info = "super girl";
- // // userService.CreateUser(usermodel);
-
- // // var user = userService.GetAll().SingleOrDefault();
-
- // // userService.Dispose(user.User_ID);
- // // Assert.AreEqual(0, userService.GetAll().Count());
- // //}
-
-
-
- // //[Test]
- // //public void GetByIdTest()
- // //{
- // // var userService = CreateUserService();
-
- // // DateTime somedate = new DateTime(2000, 07, 21);
-
- //// UserDTO usermodel = new UserDTO();
- // // usermodel.User_ID = 2;
- // // usermodel.First_Name = "Nadia";
- // // usermodel.Last_Name = "Padalka";
- // // usermodel.Email = "nadiapadalka@gmail.com";
- // // usermodel.Username = "nadiapadalka";
- // // usermodel.Password = "1111";
- // // usermodel.Birthday = somedate;
- // // usermodel.Photo_Url = "www";
- // // usermodel.Info = "super girl";
- // // userService.CreateUser(usermodel);
- // // var user = userService.GetAll().FirstOrDefault();
- // // Assert.NotNull(userService.GetById(user.User_ID));
- // //}
-
- // //[Test]
- // //public void GetAll()
- // //{
- // // var userService = CreateUserService();
-
- // // DateTime somedate = new DateTime(2000, 07, 21);
-
- // // UserDTO usermodel = new UserDTO();
- // // usermodel.User_ID = 2;
- // // usermodel.First_Name = "Nadia";
- // // usermodel.Last_Name = "Padalka";
- // // usermodel.Email = "nadiapadalka@gmail.com";
- // // usermodel.Username = "nadiapadalka";
- // // usermodel.Password = "1111";
- // // usermodel.Birthday = somedate;
- // // usermodel.Photo_Url = "www";
- // // usermodel.Info = "super girl";
- // // userService.CreateUser(usermodel);
- // // UserDTO user1 = new UserDTO(3, "Marichka", "Dymyd", "mariia@gmail.com", "mariicka", "1212", somedate, "www", "giirl");
- // // userService.CreateUser(user1);
-
- // // Assert.AreEqual(2, userService.GetAll().Count());
- // //}
- // }
+ UserService CreateUserService()
+ {
+ connection = Effort.DbConnectionFactory.CreateTransient();
+ databaseContext = new UthTripContext(connection);
+ return new UserService(new EFUnitOfWork(databaseContext));
+ }
+
+ public void Dispose()
+ {
+ databaseContext.Dispose();
+
+ }
+ [Fact]
+ public void TestCreateUserMethod()
+ {
+ var userService = CreateUserService();
+
+
+ userService.CreateUser(new UserDTO
+ {
+ User_ID = 132,
+ First_Name = "Yaroslav",
+ Last_Name = "Nolkuchak",
+ Username = "user2",
+ Email = "simonnolkuchak@com",
+ Password = "1178",
+ Birthday = DateTime.Now,
+ Photo_Url = "www",
+ Info = "another boy"
+ });
+ userService.CreateUser(new UserDTO
+ {
+ User_ID = 123,
+ First_Name = "Simon",
+ Last_Name = "Gilbert",
+ Username = "simongilbert",
+ Email = "simongilbert@com",
+ Password = "1111",
+ Birthday = DateTime.Now,
+ Photo_Url = "www",
+ Info = "some boy"
+ });
+
+
+
+ int res = userService.GetAll().Count();
+
+ Assert.Equal(2, res);
+
+ }
+
+ [Fact]
+ public void TestDeleteUserMethod()
+ {
+ var userService = CreateUserService();
+
+
+
+ userService.CreateUser(new UserDTO
+ {
+ User_ID = 132,
+ First_Name = "Yaroslav",
+ Last_Name = "Nolkuchak",
+ Username = "user2",
+ Email = "simonnolkuchak@com",
+ Password = "1178",
+ Birthday = DateTime.Now,
+ Photo_Url = "www",
+ Info = "another boy"
+ });
+ userService.CreateUser(new UserDTO
+ {
+ User_ID = 123,
+ First_Name = "Simon",
+ Last_Name = "Gilbert",
+ Username = "simongilbert",
+ Email = "simongilbert@com",
+ Password = "1111",
+ Birthday = DateTime.Now,
+ Photo_Url = "www",
+ Info = "some boy"
+ });
+
+
+ var user = userService.GetAll().FirstOrDefault();
+ userService.Dispose(user.User_ID);
+ int res = userService.GetAll().Count();
+
+ Assert.Equal(1, res);
+
+ }
+ [Fact]
+ public void TestGetByID()
+ {
+
+
+ var userService = CreateUserService();
+ userService.CreateUser(new UserDTO
+ {
+ User_ID = 132,
+ First_Name = "Yaroslav",
+ Last_Name = "Nolkuchak",
+ Username = "user2",
+ Email = "simonnolkuchak@com",
+ Password = "1178",
+ Birthday = DateTime.Now,
+ Photo_Url = "www",
+ Info = "another boy"
+ });
+ userService.CreateUser(new UserDTO
+ {
+ User_ID = 123,
+ First_Name = "Simon",
+ Last_Name = "Gilbert",
+ Username = "simongilbert",
+ Email = "simongilbert@com",
+ Password = "1111",
+ Birthday = DateTime.Now,
+ Photo_Url = "www",
+ Info = "some boy"
+ });
+
+ var user = userService.GetAll().FirstOrDefault();
+ Assert.NotNull(userService.GetById(user.User_ID));
+
+
+
+ }
+
+
+
+ [Fact]
+ public void TestFindMax_Id()
+ {
+
+ var userService = CreateUserService();
+ userService.CreateUser(new UserDTO
+ {
+ User_ID = 132,
+ First_Name = "Yaroslav",
+ Last_Name = "Nolkuchak",
+ Username = "user2",
+ Email = "simonnolkuchak@com",
+ Password = "1178",
+ Birthday = DateTime.Now,
+ Photo_Url = "www",
+ Info = "another boy"
+ });
+ userService.CreateUser(new UserDTO
+ {
+ User_ID = 123,
+ First_Name = "Simon",
+ Last_Name = "Gilbert",
+ Username = "simongilbert",
+ Email = "simongilbert@com",
+ Password = "1111",
+ Birthday = DateTime.Now,
+ Photo_Url = "www",
+ Info = "some boy"
+ });
+
+ var user = userService.GetAll().FirstOrDefault();
+
+ Assert.Equal(2, userService.FindMaxId());
+
+
+
+ }
+
+
+
+
+
+
+>>>>>>> Stashed changes
+ }
}
\ No newline at end of file
diff --git a/uthTrip.Tests/packages.config b/uthTrip.Tests/packages.config
index d3238c8..c122b90 100644
--- a/uthTrip.Tests/packages.config
+++ b/uthTrip.Tests/packages.config
@@ -1,14 +1,27 @@
+<<<<<<< Updated upstream
+=======
+
+>>>>>>> Stashed changes
-
-
-
-
+
+<<<<<<< Updated upstream
+=======
+
+
+
+
+
+
+
+
+
+>>>>>>> Stashed changes
\ No newline at end of file
diff --git a/uthTrip.Tests/uthTrip.Tests.csproj b/uthTrip.Tests/uthTrip.Tests.csproj
index 076f679..35693c4 100644
--- a/uthTrip.Tests/uthTrip.Tests.csproj
+++ b/uthTrip.Tests/uthTrip.Tests.csproj
@@ -1,5 +1,7 @@
+
+
@@ -41,9 +43,15 @@
4
+<<<<<<< Updated upstream
+=======
..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll
+
+ ..\packages\Effort.EF6.2.2.7\lib\net45\Effort.dll
+
+>>>>>>> Stashed changes
..\packages\EntityFramework.6.3.0\lib\net45\EntityFramework.dll
@@ -57,19 +65,32 @@
..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+<<<<<<< Updated upstream
+=======
..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll
..\packages\Moq.4.13.1\lib\net45\Moq.dll
+
+ ..\packages\NMemory.3.1.0\lib\net45\NMemory.dll
+
+>>>>>>> Stashed changes
..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll
-
+<<<<<<< Updated upstream
+=======
+
+
+ ..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll
+ True
+ True
+
..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
@@ -91,6 +112,19 @@
..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll
+
+ ..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll
+
+
+ ..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll
+
+
+ ..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll
+
+
+ ..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll
+
+>>>>>>> Stashed changes
@@ -109,14 +143,20 @@
{f78c2ccb-0aa4-48f9-8dc1-9f65a5135e05}
uthTrip.DAL
-
+
{32e72533-0bdc-440a-9540-af7783555306}
- UthTripProject
+ uthTripProject
+<<<<<<< Updated upstream
+=======
+
+
+
+>>>>>>> Stashed changes
@@ -128,7 +168,11 @@
+
+
+
+
\ No newline at end of file
diff --git a/uthTripProject.sln b/uthTripProject.sln
index 808c92e..9733290 100644
--- a/uthTripProject.sln
+++ b/uthTripProject.sln
@@ -1,18 +1,26 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29503.13
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.852
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UthTripProject", "uthTripProject\UthTripProject.csproj", "{32E72533-0BDC-440A-9540-AF7783555306}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uthTripProject", "uthTripProject\uthTripProject.csproj", "{32E72533-0BDC-440A-9540-AF7783555306}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uthTrip.DAL", "uthTrip.DAL\uthTrip.DAL.csproj", "{F78C2CCB-0AA4-48F9-8DC1-9F65A5135E05}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uthTrip.BLL", "uthTrip.BLL\uthTrip.BLL.csproj", "{EDEC0E39-CC42-426B-8773-F9356BA20DF9}"
EndProject
+<<<<<<< Updated upstream
+<<<<<<< HEAD
+<<<<<<< HEAD
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject1", "UnitTestProject1\UnitTestProject1.csproj", "{8B8D5CC4-86F5-4793-89EB-296325CA02F9}"
-EndProject
+=======
+=======
+>>>>>>> Stashed changes
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uthTrip.Tests", "uthTrip.Tests\uthTrip.Tests.csproj", "{92D1958E-8110-402B-8A96-4C7FE9FFF0EC}"
+>>>>>>> parent of 3e60396... added unit tests to userservice
EndProject
+=======
+>>>>>>> parent of aa645ae... added unit tests for userservice
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -31,14 +39,23 @@ Global
{EDEC0E39-CC42-426B-8773-F9356BA20DF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDEC0E39-CC42-426B-8773-F9356BA20DF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDEC0E39-CC42-426B-8773-F9356BA20DF9}.Release|Any CPU.Build.0 = Release|Any CPU
+<<<<<<< Updated upstream
+<<<<<<< HEAD
+<<<<<<< HEAD
{8B8D5CC4-86F5-4793-89EB-296325CA02F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B8D5CC4-86F5-4793-89EB-296325CA02F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B8D5CC4-86F5-4793-89EB-296325CA02F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B8D5CC4-86F5-4793-89EB-296325CA02F9}.Release|Any CPU.Build.0 = Release|Any CPU
+=======
+=======
+>>>>>>> Stashed changes
{92D1958E-8110-402B-8A96-4C7FE9FFF0EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92D1958E-8110-402B-8A96-4C7FE9FFF0EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92D1958E-8110-402B-8A96-4C7FE9FFF0EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92D1958E-8110-402B-8A96-4C7FE9FFF0EC}.Release|Any CPU.Build.0 = Release|Any CPU
+>>>>>>> parent of 3e60396... added unit tests to userservice
+=======
+>>>>>>> parent of aa645ae... added unit tests for userservice
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/uthTripProject/App_Start/BundleConfig.cs b/uthTripProject/App_Start/BundleConfig.cs
index 20080b3..e1ef832 100644
--- a/uthTripProject/App_Start/BundleConfig.cs
+++ b/uthTripProject/App_Start/BundleConfig.cs
@@ -1,11 +1,11 @@
-namespace UthTripProject
-{
- using System.Web;
- using System.Web.Optimization;
+using System.Web;
+using System.Web.Optimization;
+namespace uthTripProject
+{
public class BundleConfig
{
- //// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
+ // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
@@ -26,8 +26,11 @@ public static void RegisterBundles(BundleCollection bundles)
"~/Content/bootstrap.css",
"~/Content/site.css"));
+
bundles.Add(new ScriptBundle("~/bundles/background").Include(
"~/Scripts/background.js"));
+
+
}
}
}
diff --git a/uthTripProject/App_Start/FilterConfig.cs b/uthTripProject/App_Start/FilterConfig.cs
index fb46c32..745b690 100644
--- a/uthTripProject/App_Start/FilterConfig.cs
+++ b/uthTripProject/App_Start/FilterConfig.cs
@@ -1,8 +1,8 @@
-namespace UthTripProject
-{
- using System.Web;
- using System.Web.Mvc;
+using System.Web;
+using System.Web.Mvc;
+namespace uthTripProject
+{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
diff --git a/uthTripProject/App_Start/IdentityConfig.cs b/uthTripProject/App_Start/IdentityConfig.cs
index 58324a3..9c6a799 100644
--- a/uthTripProject/App_Start/IdentityConfig.cs
+++ b/uthTripProject/App_Start/IdentityConfig.cs
@@ -1,110 +1,109 @@
-namespace UthTripProject
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Linq;
+using System.Security.Claims;
+using System.Threading.Tasks;
+using System.Web;
+using Microsoft.AspNet.Identity;
+using Microsoft.AspNet.Identity.EntityFramework;
+using Microsoft.AspNet.Identity.Owin;
+using Microsoft.Owin;
+using Microsoft.Owin.Security;
+using uthTripProject.Models;
+
+namespace uthTripProject
{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Security.Claims;
- using System.Threading.Tasks;
- using System.Web;
- using Microsoft.AspNet.Identity;
- using Microsoft.AspNet.Identity.EntityFramework;
- using Microsoft.AspNet.Identity.Owin;
- using Microsoft.Owin;
- using Microsoft.Owin.Security;
- using UthTripProject.Models;
- /*
- public class EmailService : IIdentityMessageService
- {
- public Task SendAsync(IdentityMessage message)
- {
- // Plug in your email service here to send an email.
- return Task.FromResult(0);
- }
- }
+ //public class EmailService : IIdentityMessageService
+ //{
+ // public Task SendAsync(IdentityMessage message)
+ // {
+ // // Plug in your email service here to send an email.
+ // return Task.FromResult(0);
+ // }
+ //}
- public class SmsService : IIdentityMessageService
- {
- public Task SendAsync(IdentityMessage message)
- {
- // Plug in your SMS service here to send a text message.
- return Task.FromResult(0);
- }
- }
+ //public class SmsService : IIdentityMessageService
+ //{
+ // public Task SendAsync(IdentityMessage message)
+ // {
+ // // Plug in your SMS service here to send a text message.
+ // return Task.FromResult(0);
+ // }
+ //}
- // Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
- public class ApplicationUserManager : UserManager
- {
- public ApplicationUserManager(IUserStore store)
- : base(store)
- {
- }
+ //// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
+ //public class ApplicationUserManager : UserManager
+ //{
+ // public ApplicationUserManager(IUserStore store)
+ // : base(store)
+ // {
+ // }
- public static ApplicationUserManager Create(IdentityFactoryOptions options, IOwinContext context)
- {
- var manager = new ApplicationUserManager(new UserStore(context.Get()));
- // Configure validation logic for usernames
- manager.UserValidator = new UserValidator(manager)
- {
- AllowOnlyAlphanumericUserNames = false,
- RequireUniqueEmail = true
- };
+ // public static ApplicationUserManager Create(IdentityFactoryOptions options, IOwinContext context)
+ // {
+ // var manager = new ApplicationUserManager(new UserStore(context.Get()));
+ // // Configure validation logic for usernames
+ // manager.UserValidator = new UserValidator(manager)
+ // {
+ // AllowOnlyAlphanumericUserNames = false,
+ // RequireUniqueEmail = true
+ // };
- // Configure validation logic for passwords
- manager.PasswordValidator = new PasswordValidator
- {
- RequiredLength = 6,
- RequireNonLetterOrDigit = true,
- RequireDigit = true,
- RequireLowercase = true,
- RequireUppercase = true,
- };
+ // // Configure validation logic for passwords
+ // manager.PasswordValidator = new PasswordValidator
+ // {
+ // RequiredLength = 6,
+ // RequireNonLetterOrDigit = true,
+ // RequireDigit = true,
+ // RequireLowercase = true,
+ // RequireUppercase = true,
+ // };
- // Configure user lockout defaults
- manager.UserLockoutEnabledByDefault = true;
- manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
- manager.MaxFailedAccessAttemptsBeforeLockout = 5;
+ // // Configure user lockout defaults
+ // manager.UserLockoutEnabledByDefault = true;
+ // manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
+ // manager.MaxFailedAccessAttemptsBeforeLockout = 5;
- // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
- // You can write your own provider and plug it in here.
- manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider
- {
- MessageFormat = "Your security code is {0}"
- });
- manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider
- {
- Subject = "Security Code",
- BodyFormat = "Your security code is {0}"
- });
- manager.EmailService = new EmailService();
- manager.SmsService = new SmsService();
- var dataProtectionProvider = options.DataProtectionProvider;
- if (dataProtectionProvider != null)
- {
- manager.UserTokenProvider =
- new DataProtectorTokenProvider(dataProtectionProvider.Create("ASP.NET Identity"));
- }
- return manager;
- }
- }
+ // // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
+ // // You can write your own provider and plug it in here.
+ // manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider
+ // {
+ // MessageFormat = "Your security code is {0}"
+ // });
+ // manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider
+ // {
+ // Subject = "Security Code",
+ // BodyFormat = "Your security code is {0}"
+ // });
+ // manager.EmailService = new EmailService();
+ // manager.SmsService = new SmsService();
+ // var dataProtectionProvider = options.DataProtectionProvider;
+ // if (dataProtectionProvider != null)
+ // {
+ // manager.UserTokenProvider =
+ // new DataProtectorTokenProvider(dataProtectionProvider.Create("ASP.NET Identity"));
+ // }
+ // return manager;
+ // }
+ //}
- // Configure the application sign-in manager which is used in this application.
- public class ApplicationSignInManager : SignInManager
- {
- public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
- : base(userManager, authenticationManager)
- {
- }
+ //// Configure the application sign-in manager which is used in this application.
+ //public class ApplicationSignInManager : SignInManager
+ //{
+ // public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
+ // : base(userManager, authenticationManager)
+ // {
+ // }
- public override Task CreateUserIdentityAsync(ApplicationUser user)
- {
- return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
- }
+ // public override Task CreateUserIdentityAsync(ApplicationUser user)
+ // {
+ // return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
+ // }
- public static ApplicationSignInManager Create(IdentityFactoryOptions options, IOwinContext context)
- {
- return new ApplicationSignInManager(context.GetUserManager(), context.Authentication);
- }
- }
- */
+ // public static ApplicationSignInManager Create(IdentityFactoryOptions options, IOwinContext context)
+ // {
+ // return new ApplicationSignInManager(context.GetUserManager(), context.Authentication);
+ // }
+ //}
}
diff --git a/uthTripProject/App_Start/RouteConfig.cs b/uthTripProject/App_Start/RouteConfig.cs
index 2009f8c..6633a1e 100644
--- a/uthTripProject/App_Start/RouteConfig.cs
+++ b/uthTripProject/App_Start/RouteConfig.cs
@@ -1,12 +1,12 @@
-namespace UthTripProject
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Web.Routing;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Routing;
+namespace uthTripProject
+{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
@@ -16,7 +16,8 @@ public static void RegisterRoutes(RouteCollection routes)
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
- defaults: new { controller = "Home", action = "Login", id = UrlParameter.Optional });
+ defaults: new { controller = "Home", action = "Login", id = UrlParameter.Optional }
+ );
}
}
}
diff --git a/uthTripProject/App_Start/Startup.Auth.cs b/uthTripProject/App_Start/Startup.Auth.cs
index c6b6b7d..ba8f36d 100644
--- a/uthTripProject/App_Start/Startup.Auth.cs
+++ b/uthTripProject/App_Start/Startup.Auth.cs
@@ -1,68 +1,68 @@
-namespace UthTripProject
-{
- using System;
- using Microsoft.AspNet.Identity;
- using Microsoft.AspNet.Identity.Owin;
- using Microsoft.Owin;
- using Microsoft.Owin.Security.Cookies;
- using Microsoft.Owin.Security.Google;
- using Owin;
- using UthTripProject.Models;
+using System;
+using Microsoft.AspNet.Identity;
+using Microsoft.AspNet.Identity.Owin;
+using Microsoft.Owin;
+using Microsoft.Owin.Security.Cookies;
+using Microsoft.Owin.Security.Google;
+using Owin;
+using uthTripProject.Models;
+namespace uthTripProject
+{
public partial class Startup
{
- //// For more information on configuring authentication, please visit https://go.microsoft.com/fwlink/?LinkId=301864
+ // For more information on configuring authentication, please visit https://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
- //// Configure the db context, user manager and signin manager to use a single instance per request
- //// app.CreatePerOwinContext(ApplicationDbContext.Create);
- ////app.CreatePerOwinContext(ApplicationUserManager.Create);
- ////app.CreatePerOwinContext(ApplicationSignInManager.Create);
+ // Configure the db context, user manager and signin manager to use a single instance per request
+ // app.CreatePerOwinContext(ApplicationDbContext.Create);
+ //app.CreatePerOwinContext(ApplicationUserManager.Create);
+ //app.CreatePerOwinContext(ApplicationSignInManager.Create);
- //// Enable the application to use a cookie to store information for the signed in user
- //// and to use a cookie to temporarily store information about a user logging in with a third party login provider
- //// Configure the sign in cookie
+ // Enable the application to use a cookie to store information for the signed in user
+ // and to use a cookie to temporarily store information about a user logging in with a third party login provider
+ // Configure the sign in cookie
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
- //// Enables the application to validate the security stamp when the user logs in.
- //// This is a security feature which is used when you change a password or add an external login to your account.
- ////OnValidateIdentity = SecurityStampValidator.OnValidateIdentity(
- //// validateInterval: TimeSpan.FromMinutes(30),
- ////regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
- },
- });
+ // Enables the application to validate the security stamp when the user logs in.
+ // This is a security feature which is used when you change a password or add an external login to your account.
+ //OnValidateIdentity = SecurityStampValidator.OnValidateIdentity(
+ // validateInterval: TimeSpan.FromMinutes(30),
+ //regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
+ }
+ });
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
- //// Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
+ // Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
- //// Enables the application to remember the second login verification factor such as phone or email.
- //// Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from.
- //// This is similar to the RememberMe option when you log in.
+ // Enables the application to remember the second login verification factor such as phone or email.
+ // Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from.
+ // This is similar to the RememberMe option when you log in.
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
- //// Uncomment the following lines to enable logging in with third party login providers
- ////app.UseMicrosoftAccountAuthentication(
- //// clientId: "",
- //// clientSecret: "");
+ // Uncomment the following lines to enable logging in with third party login providers
+ //app.UseMicrosoftAccountAuthentication(
+ // clientId: "",
+ // clientSecret: "");
- ////app.UseTwitterAuthentication(
- //// consumerKey: "",
- //// consumerSecret: "");
+ //app.UseTwitterAuthentication(
+ // consumerKey: "",
+ // consumerSecret: "");
- ////app.UseFacebookAuthentication(
- //// appId: "",
- //// appSecret: "");
+ //app.UseFacebookAuthentication(
+ // appId: "",
+ // appSecret: "");
- ////app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
- ////{
- //// ClientId = "",
- //// ClientSecret = ""
- ////});
+ //app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
+ //{
+ // ClientId = "",
+ // ClientSecret = ""
+ //});
}
}
}
\ No newline at end of file
diff --git a/uthTripProject/Content/Site.css b/uthTripProject/Content/Site.css
index c9e9913..758f228 100644
--- a/uthTripProject/Content/Site.css
+++ b/uthTripProject/Content/Site.css
@@ -1,4 +1,9 @@
-
+body {
+ padding-top: 50px;
+ padding-bottom: 20px;
+
+}
+
/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
@@ -56,7 +61,7 @@ textarea {
#hello-btn {
color: #fff;
text-decoration: none;
- border: black 1px solid;
+ border: #ccc 1px solid;
border-radius: 25px;
line-height: 2em;
font-weight: bold;
diff --git a/uthTripProject/Content/createTrip.css b/uthTripProject/Content/createTrip.css
deleted file mode 100644
index b868eab..0000000
--- a/uthTripProject/Content/createTrip.css
+++ /dev/null
@@ -1,97 +0,0 @@
-* {
- margin: 0;
- padding: 0;
-}
-
-body {
- background: url('https://tripway.com/blog/wp-content/uploads/2018/05/severnoe-siyanie.jpg') bottom no-repeat transparent;
- background-repeat: no-repeat center center fixed;
- background-attachment: fixed;
- background-position: center;
- background-size: 100%;
- height: 100%;
- background-size: cover;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
- font-size: 16px;
- font-family: sans-serif;
-}
-.background {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: -1;
-}
-#nav-bar {
- position: sticky;
- top: 0;
- z-index: 40;
-}
-
-.navbar {
- /* padding: 10 !important;*/
- background-color: #FFFFFE;
-}
-
-.navbar-nav li {
- padding: 0 10px;
-}
-
- .navbar-nav li a {
- float: right;
- text-align: left;
- color: #5B5B5B;
- /*font-weight: 600;*/
- }
-
-.fa-bars {
- color: #5B5B5B;
- font-size: 30px !important;
-}
-
-.navbar-toggler {
- outline: none !important;
-}
-.container .card {
- /* background-color: rgba(245, 245, 245, 1);*/
- margin: 0 auto;
- width: 500px;
- border-radius: 22px;
-}
-
-.divider-text {
- position: relative;
- text-align: center;
- margin-top: 15px;
- margin-bottom: 15px;
-}
-
-.card-title {
- font-size: 40px;
-}
-
-.divider-text span {
- padding: 7px;
- font-size: 12px;
- position: relative;
- z-index: 2;
-}
-
-.divider-text:after {
- content: "";
- position: absolute;
- width: 100%;
- border-bottom: 1px solid #ddd;
- top: 55%;
- left: 0;
- z-index: 1;
-}
-
-
-
-.body h2 {
- color: #ffffff;
- text-align: center;
- margin: 50px;
-}
diff --git a/uthTripProject/Content/home.css b/uthTripProject/Content/home.css
deleted file mode 100644
index c3dc3e9..0000000
--- a/uthTripProject/Content/home.css
+++ /dev/null
@@ -1,187 +0,0 @@
-body {
- padding-top: 8px;
- padding-bottom: 5px;
- background: url('https://images.1plus1.video/news-1/29456/1020x565.jpg') bottom no-repeat transparent;
- background-repeat: no-repeat center center fixed;
- background-attachment: fixed;
- background-position: center;
- background-size: 100%;
- height: 100%;
- background-size: cover;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
- font-size: 16px;
-}
-
-.background {
-
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: -1;
-}
-
-#hello-btn {
- color: #fff;
- text-decoration: none;
- border: 1px solid black;
- border-radius: 25px;
- line-height: 2em;
- font-weight: bold;
- font-size: 21px;
- background: none;
-}
-
- #hello-btn:hover {
- color: #b19295;
- border: gray 1px solid;
- }
-
-.row {
- text-align: center;
-
-}
-
-#row {
- background: rgba(211,211,211, 0.6);
- margin: 15px;
-}
-
-#maxPeople, #maxPrice {
- height: 55px;
- background: none;
- color: white;
- border: 1px solid black;
-}
-
-#Country {
- width: 100px;
- height: 55px;
- background: none;
- color: white;
- border: 1px solid black;
-}
-
- #Country option {
- background: none;
- color: black;
- border: 1px solid black;
- }
-
-#City {
- height: 55px;
- background: none;
- color: white;
- border: 1px solid black;
-
- width: 86px;
- text-align: center;
- padding: 9px;
-}
-
-
- #City option {
- background: none;
- color: black;
- border: 1px solid black;
- }
-
-.alow-trips {
- color: white;
- font-weight: bold;
- font-size: 40px;
-
- left: 0;
- top: 0;
-
- text-align: center;
-}
-
-.buton-wrapper {
- font-size: 27px;
- font-weight: bold;
-
- text-align: center;
-}
-
-#button-trip {
-
-}
-#link-to-add-trip {
- background: rgba(0,0,0,0.35);
- padding: 10px;
-}
-. /*body-content {
- margin-top:100px;
-}*/
-.toptop {
- padding: 20px;
-}
-
-#tripText, #tripTextDate {
- color: white;
- font-size: 25px;
- height: 100%;
-
- align-items: center;
- margin-top: 29px;
-}
-
-#price {
- margin: 0 auto;
-}
-
-/*#row-wrapper {
- background: rgba(211,211,211, 0.6);
- margin: 15px;
-}*/
-
-#tripTextDate {
- margin-top: 15px;
-}
-
-#tripTextButton {
- font-size: 20px;
- height: 100%;
- align-items: center;
- margin-top: 29px;
-}
-
-.button-a {
- border: 1px solid black;
- border-radius: 20px;
- pading: 10px;
- padding: 5px;
- margin-left: 22px;
-}
-
-#nav-bar {
- position: sticky;
- top: 0;
- z-index: 40;
-}
-
-.navbar {
- /* padding: 10 !important;*/
- background-color: #FFFFFE;
-}
-
-.navbar-nav li {
- padding: 0 10px;
-}
-
- .navbar-nav li a {
- float: right;
- text-align: left;
- color: #5B5B5B;
- /*font-weight: 600;*/
- }
-
-.fa-bars {
- color: #5B5B5B;
- font-size: 30px !important;
-}
-
-.navbar-toggler {
- outline: none !important;
-}
\ No newline at end of file
diff --git a/uthTripProject/Content/layout.css b/uthTripProject/Content/layout.css
deleted file mode 100644
index 04108dd..0000000
--- a/uthTripProject/Content/layout.css
+++ /dev/null
@@ -1,18 +0,0 @@
-body {
-
- padding-top: 0 !important;
-}
-
-
-
-
-.footer {
- bottom: 0;
- padding-left: 20px;
- font-size: 14px;
- color: #fff !important;
-}
- .bottom {
- position: absolute !important;
- bottom: 0 !important;
-}
\ No newline at end of file
diff --git a/uthTripProject/Content/login.css b/uthTripProject/Content/login.css
deleted file mode 100644
index f098127..0000000
--- a/uthTripProject/Content/login.css
+++ /dev/null
@@ -1,66 +0,0 @@
-body
-{
- padding-top: 8px;
- padding-bottom: 5px;
-}
-.body-login {
- background: url('https://tripway.com/blog/wp-content/uploads/2018/05/severnoe-siyanie.jpg') bottom no-repeat transparent;
- background-repeat: no-repeat center center fixed;
- background-attachment: fixed;
- background-position: center;
- background-size: 100%;
- height: 100%;
- background-size: cover;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
- font-size: 16px;
-}
-.container .card {
- /* background-color: rgba(245, 245, 245, 1);*/
- margin: 0 auto;
- width: 500px;
- border-radius: 22px;
-}
-
-.divider-text {
- position: relative;
- text-align: center;
- margin-top: 15px;
- margin-bottom: 15px;
-}
-
-.card-title {
- font-size: 40px;
-}
-
-.divider-text span {
- padding: 7px;
- font-size: 12px;
- position: relative;
- z-index: 2;
-}
-
-.divider-text:after {
- content: "";
- position: absolute;
- width: 100%;
- border-bottom: 1px solid #ddd;
- top: 55%;
- left: 0;
- z-index: 1;
-}
-
-.btn-facebook {
- background-color: #405D9D;
- color: #fff;
-}
-
-.btn-twitter {
- background-color: #42AEEC;
- color: #fff;
-}
-
-.body-login h2 {
- color: #ffffff;
- text-align: center;
- margin: 50px;
-}
diff --git a/uthTripProject/Content/myTrips.css b/uthTripProject/Content/myTrips.css
deleted file mode 100644
index 5084b76..0000000
--- a/uthTripProject/Content/myTrips.css
+++ /dev/null
@@ -1,121 +0,0 @@
-* {
- margin: 0;
- padding: 0;
-}
-
-body {
- background: url('https://tripway.com/blog/wp-content/uploads/2018/05/severnoe-siyanie.jpg') bottom no-repeat transparent;
- background-repeat: no-repeat center center fixed;
- background-attachment: fixed;
- background-position: center;
- background-size: 100%;
- height: 100%;
- background-size: cover;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
- font-size: 16px;
- font-family: sans-serif;
-}
-
-.background {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: -1;
-}
-
-#nav-bar {
- position: sticky;
- top: 0;
- z-index: 40;
-}
-
-.navbar {
- /* padding: 10 !important;*/
- background-color: #FFFFFE;
-}
-
-.navbar-nav li {
- padding: 0 10px;
-}
-
- .navbar-nav li a {
- float: right;
- text-align: left;
- color: #5B5B5B;
- /*font-weight: 600;*/
- }
-
-.fa-bars {
- color: #5B5B5B;
- font-size: 30px !important;
-}
-
-.navbar-toggler {
- outline: none !important;
-}
-
-.container .card {
- /* background-color: rgba(245, 245, 245, 1);*/
- margin: 0 auto;
- width: 500px;
- border-radius: 22px;
-}
-
-.divider-text {
- position: relative;
- text-align: center;
- margin-top: 15px;
- margin-bottom: 15px;
-}
-
-.card-title {
- font-size: 40px;
-}
-
-.divider-text span {
- padding: 7px;
- font-size: 12px;
- position: relative;
- z-index: 2;
-}
-
-.divider-text:after {
- content: "";
- position: absolute;
- width: 100%;
- top: 55%;
- left: 0;
- z-index: 1;
-}
-
-.body h2 {
- color: #ffffff;
- text-align: center;
- margin: 50px;
-}
-
-span {
- font-size: 15px;
-}
-
-a {
- text-decoration: none;
- color: #0062cc;
-}
-
-.box {
- padding: 60px 0px;
-}
-
-.box-part {
- background: #FFF;
- border-radius: 0;
- padding: 60px 10px;
- margin: 15px 0px;
-}
-
-.text {
- margin: 20px 0px;
-}
diff --git a/uthTripProject/Content/registration.css b/uthTripProject/Content/registration.css
deleted file mode 100644
index c4088c5..0000000
--- a/uthTripProject/Content/registration.css
+++ /dev/null
@@ -1,65 +0,0 @@
-
-body {
- padding-top: 8px;
- padding-bottom: 5px;
-}
-.body-user {
- background: url('https://tripway.com/blog/wp-content/uploads/2018/05/severnoe-siyanie.jpg') bottom no-repeat transparent;
- background-repeat: no-repeat center center fixed;
- background-attachment: fixed;
- background-position: center;
- background-size: 100%;
- height: 100%;
- background-size: cover;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
- font-size: 16px;
-}
-
-.container .card {
- /* background-color: rgba(245, 245, 245, 1);*/
-
- margin: 0 auto;
- width: 500px;
- border-radius: 22px;
-}
-.divider-text {
- position: relative;
- text-align: center;
- margin-top: 15px;
- margin-bottom: 15px;
-}
-.card-title {
- font-size: 40px;
-}
-.divider-text span {
- padding: 7px;
- font-size: 12px;
- position: relative;
- z-index: 2;
-}
-
-.divider-text:after {
- content: "";
- position: absolute;
- width: 100%;
- border-bottom: 1px solid #ddd;
- top: 55%;
- left: 0;
- z-index: 1;
-}
-
-.btn-facebook {
- background-color: #405D9D;
- color: #fff;
-}
-
-.btn-twitter {
- background-color: #42AEEC;
- color: #fff;
-}
-
-.body-user h2 {
- color: #ffffff;
- text-align: center;
- margin: 50px;
- }
diff --git a/uthTripProject/Content/tripDetail.css b/uthTripProject/Content/tripDetail.css
deleted file mode 100644
index f4f7ccf..0000000
--- a/uthTripProject/Content/tripDetail.css
+++ /dev/null
@@ -1,62 +0,0 @@
-body {
- background: url('https://tripway.com/blog/wp-content/uploads/2018/05/severnoe-siyanie.jpg') bottom no-repeat transparent;
- background-repeat: no-repeat center center fixed;
- background-attachment: fixed;
- background-position: center;
- background-size: 100%;
- height: 100%;
- background-size: cover;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
- font-size: 16px;
- font-family: sans-serif;
-}
-.background {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: -1;
-}
-
-#nav-bar {
- position: sticky;
- top: 0;
- z-index: 40;
-}
-
-.navbar {
- /* padding: 10 !important;*/
- background-color: #FFFFFE;
-}
-
-.navbar-nav li {
- padding: 0 10px;
-}
-
- .navbar-nav li a {
- float: right;
- text-align: left;
- color: #5B5B5B;
- /*font-weight: 600;*/
- }
-
-.fa-bars {
- color: #5B5B5B;
- font-size: 30px !important;
-}
-
-.navbar-toggler {
- outline: none !important;
-}
-
-.container .card {
- /* background-color: rgba(245, 245, 245, 1);*/
- margin: 0 auto;
- width: 500px;
- border-radius: 22px;
-}
-
-.card-title {
- font-size: 40px;
-}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/AccountController.cs b/uthTripProject/Controllers/AccountController.cs
index 42309b6..213c03b 100644
--- a/uthTripProject/Controllers/AccountController.cs
+++ b/uthTripProject/Controllers/AccountController.cs
@@ -1,486 +1,485 @@
-namespace UthTripProject.Controllers
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Security.Claims;
+using System.Threading.Tasks;
+using System.Web;
+using System.Web.Mvc;
+using Microsoft.AspNet.Identity;
+using Microsoft.AspNet.Identity.Owin;
+using Microsoft.Owin.Security;
+using uthTripProject.Models;
+
+namespace uthTripProject.Controllers
{
- using System;
- using System.Globalization;
- using System.Linq;
- using System.Security.Claims;
- using System.Threading.Tasks;
- using System.Web;
- using System.Web.Mvc;
- using Microsoft.AspNet.Identity;
- using Microsoft.AspNet.Identity.Owin;
- using Microsoft.Owin.Security;
- using UthTripProject.Models;
-
- /* [Authorize]
- public class AccountController : Controller
- {
- private ApplicationSignInManager _signInManager;
- private ApplicationUserManager _userManager;
-
- public AccountController()
- {
- }
-
- public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager)
- {
- UserManager = userManager;
- SignInManager = signInManager;
- }
-
- public ApplicationSignInManager SignInManager
- {
- get
- {
- return _signInManager ?? HttpContext.GetOwinContext().Get();
- }
- private set
- {
- _signInManager = value;
- }
- }
-
- public ApplicationUserManager UserManager
- {
- get
- {
- return _userManager ?? HttpContext.GetOwinContext().GetUserManager();
- }
- private set
- {
- _userManager = value;
- }
- }
-
- //
- // GET: /Account/Login
- [AllowAnonymous]
- public ActionResult Login(string returnUrl)
- {
- ViewBag.ReturnUrl = returnUrl;
- return View();
- }
-
- //
- // POST: /Account/Login
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public async Task Login(LoginViewModel model, string returnUrl)
- {
- if (!ModelState.IsValid)
- {
- return View(model);
- }
-
- // This doesn't count login failures towards account lockout
- // To enable password failures to trigger account lockout, change to shouldLockout: true
- var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
- switch (result)
- {
- case SignInStatus.Success:
- return RedirectToLocal(returnUrl);
- case SignInStatus.LockedOut:
- return View("Lockout");
- case SignInStatus.RequiresVerification:
- return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
- case SignInStatus.Failure:
- default:
- ModelState.AddModelError("", "Invalid login attempt.");
- return View(model);
- }
- }
-
- //
- // GET: /Account/VerifyCode
- [AllowAnonymous]
- public async Task VerifyCode(string provider, string returnUrl, bool rememberMe)
- {
- // Require that the user has already logged in via username/password or external login
- if (!await SignInManager.HasBeenVerifiedAsync())
- {
- return View("Error");
- }
- return View(new VerifyCodeViewModel { Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe });
- }
-
- //
- // POST: /Account/VerifyCode
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public async Task VerifyCode(VerifyCodeViewModel model)
- {
- if (!ModelState.IsValid)
- {
- return View(model);
- }
-
- // The following code protects for brute force attacks against the two factor codes.
- // If a user enters incorrect codes for a specified amount of time then the user account
- // will be locked out for a specified amount of time.
- // You can configure the account lockout settings in IdentityConfig
- var result = await SignInManager.TwoFactorSignInAsync(model.Provider, model.Code, isPersistent: model.RememberMe, rememberBrowser: model.RememberBrowser);
- switch (result)
- {
- case SignInStatus.Success:
- return RedirectToLocal(model.ReturnUrl);
- case SignInStatus.LockedOut:
- return View("Lockout");
- case SignInStatus.Failure:
- default:
- ModelState.AddModelError("", "Invalid code.");
- return View(model);
- }
- }
-
- //
- // GET: /Account/Register
- [AllowAnonymous]
- public ActionResult Register()
- {
- return View();
- }
-
- //
- // POST: /Account/Register
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public async Task Register(RegisterViewModel model)
- {
- if (ModelState.IsValid)
- {
- var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
- var result = await UserManager.CreateAsync(user, model.Password);
- if (result.Succeeded)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
-
- // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
- // Send an email with this link
- // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
- // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
- // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking here");
-
- return RedirectToAction("Index", "Home");
- }
- AddErrors(result);
- }
-
- // If we got this far, something failed, redisplay form
- return View(model);
- }
-
- //
- // GET: /Account/ConfirmEmail
- [AllowAnonymous]
- public async Task ConfirmEmail(string userId, string code)
- {
- if (userId == null || code == null)
- {
- return View("Error");
- }
- var result = await UserManager.ConfirmEmailAsync(userId, code);
- return View(result.Succeeded ? "ConfirmEmail" : "Error");
- }
-
- //
- // GET: /Account/ForgotPassword
- [AllowAnonymous]
- public ActionResult ForgotPassword()
- {
- return View();
- }
-
- //
- // POST: /Account/ForgotPassword
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public async Task ForgotPassword(ForgotPasswordViewModel model)
- {
- if (ModelState.IsValid)
- {
- var user = await UserManager.FindByNameAsync(model.Email);
- if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)))
- {
- // Don't reveal that the user does not exist or is not confirmed
- return View("ForgotPasswordConfirmation");
- }
-
- // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
- // Send an email with this link
- // string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
- // var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
- // await UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking here");
- // return RedirectToAction("ForgotPasswordConfirmation", "Account");
- }
-
- // If we got this far, something failed, redisplay form
- return View(model);
- }
-
- //
- // GET: /Account/ForgotPasswordConfirmation
- [AllowAnonymous]
- public ActionResult ForgotPasswordConfirmation()
- {
- return View();
- }
-
- //
- // GET: /Account/ResetPassword
- [AllowAnonymous]
- public ActionResult ResetPassword(string code)
- {
- return code == null ? View("Error") : View();
- }
-
- //
- // POST: /Account/ResetPassword
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public async Task ResetPassword(ResetPasswordViewModel model)
- {
- if (!ModelState.IsValid)
- {
- return View(model);
- }
- var user = await UserManager.FindByNameAsync(model.Email);
- if (user == null)
- {
- // Don't reveal that the user does not exist
- return RedirectToAction("ResetPasswordConfirmation", "Account");
- }
- var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
- if (result.Succeeded)
- {
- return RedirectToAction("ResetPasswordConfirmation", "Account");
- }
- AddErrors(result);
- return View();
- }
-
- //
- // GET: /Account/ResetPasswordConfirmation
- [AllowAnonymous]
- public ActionResult ResetPasswordConfirmation()
- {
- return View();
- }
-
- //
- // POST: /Account/ExternalLogin
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public ActionResult ExternalLogin(string provider, string returnUrl)
- {
- // Request a redirect to the external login provider
- return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
- }
-
- //
- // GET: /Account/SendCode
- [AllowAnonymous]
- public async Task SendCode(string returnUrl, bool rememberMe)
- {
- var userId = await SignInManager.GetVerifiedUserIdAsync();
- if (userId == null)
- {
- return View("Error");
- }
- var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(userId);
- var factorOptions = userFactors.Select(purpose => new SelectListItem { Text = purpose, Value = purpose }).ToList();
- return View(new SendCodeViewModel { Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe });
- }
-
- //
- // POST: /Account/SendCode
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public async Task SendCode(SendCodeViewModel model)
- {
- if (!ModelState.IsValid)
- {
- return View();
- }
-
- // Generate the token and send it
- if (!await SignInManager.SendTwoFactorCodeAsync(model.SelectedProvider))
- {
- return View("Error");
- }
- return RedirectToAction("VerifyCode", new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe });
- }
-
- //
- // GET: /Account/ExternalLoginCallback
- [AllowAnonymous]
- public async Task ExternalLoginCallback(string returnUrl)
- {
- var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
- if (loginInfo == null)
- {
- return RedirectToAction("Login");
- }
-
- // Sign in the user with this external login provider if the user already has a login
- var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
- switch (result)
- {
- case SignInStatus.Success:
- return RedirectToLocal(returnUrl);
- case SignInStatus.LockedOut:
- return View("Lockout");
- case SignInStatus.RequiresVerification:
- return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false });
- case SignInStatus.Failure:
- default:
- // If the user does not have an account, then prompt the user to create an account
- ViewBag.ReturnUrl = returnUrl;
- ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
- return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });
- }
- }
-
- //
- // POST: /Account/ExternalLoginConfirmation
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public async Task ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
- {
- if (User.Identity.IsAuthenticated)
- {
- return RedirectToAction("Index", "Manage");
- }
-
- if (ModelState.IsValid)
- {
- // Get the information about the user from the external login provider
- var info = await AuthenticationManager.GetExternalLoginInfoAsync();
- if (info == null)
- {
- return View("ExternalLoginFailure");
- }
- var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
- var result = await UserManager.CreateAsync(user);
- if (result.Succeeded)
- {
- result = await UserManager.AddLoginAsync(user.Id, info.Login);
- if (result.Succeeded)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
- return RedirectToLocal(returnUrl);
- }
- }
- AddErrors(result);
- }
-
- ViewBag.ReturnUrl = returnUrl;
- return View(model);
- }
-
- //
- // POST: /Account/LogOff
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult LogOff()
- {
- AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
- return RedirectToAction("Index", "Home");
- }
-
- //
- // GET: /Account/ExternalLoginFailure
- [AllowAnonymous]
- public ActionResult ExternalLoginFailure()
- {
- return View();
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (_userManager != null)
- {
- _userManager.Dispose();
- _userManager = null;
- }
-
- if (_signInManager != null)
- {
- _signInManager.Dispose();
- _signInManager = null;
- }
- }
-
- base.Dispose(disposing);
- }
-
- #region Helpers
- // Used for XSRF protection when adding external logins
- private const string XsrfKey = "XsrfId";
-
- private IAuthenticationManager AuthenticationManager
- {
- get
- {
- return HttpContext.GetOwinContext().Authentication;
- }
- }
-
- private void AddErrors(IdentityResult result)
- {
- foreach (var error in result.Errors)
- {
- ModelState.AddModelError("", error);
- }
- }
-
- private ActionResult RedirectToLocal(string returnUrl)
- {
- if (Url.IsLocalUrl(returnUrl))
- {
- return Redirect(returnUrl);
- }
- return RedirectToAction("Index", "Home");
- }
-
- internal class ChallengeResult : HttpUnauthorizedResult
- {
- public ChallengeResult(string provider, string redirectUri)
- : this(provider, redirectUri, null)
- {
- }
-
- public ChallengeResult(string provider, string redirectUri, string userId)
- {
- LoginProvider = provider;
- RedirectUri = redirectUri;
- UserId = userId;
- }
-
- public string LoginProvider { get; set; }
- public string RedirectUri { get; set; }
- public string UserId { get; set; }
-
- public override void ExecuteResult(ControllerContext context)
- {
- var properties = new AuthenticationProperties { RedirectUri = RedirectUri };
- if (UserId != null)
- {
- properties.Dictionary[XsrfKey] = UserId;
- }
- context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider);
- }
- }
- #endregion
- }
- */
+// [Authorize]
+// public class AccountController : Controller
+// {
+// private ApplicationSignInManager _signInManager;
+// private ApplicationUserManager _userManager;
+
+// public AccountController()
+// {
+// }
+
+// public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager )
+// {
+// UserManager = userManager;
+// SignInManager = signInManager;
+// }
+
+// public ApplicationSignInManager SignInManager
+// {
+// get
+// {
+// return _signInManager ?? HttpContext.GetOwinContext().Get();
+// }
+// private set
+// {
+// _signInManager = value;
+// }
+// }
+
+// public ApplicationUserManager UserManager
+// {
+// get
+// {
+// return _userManager ?? HttpContext.GetOwinContext().GetUserManager();
+// }
+// private set
+// {
+// _userManager = value;
+// }
+// }
+
+// //
+// // GET: /Account/Login
+// [AllowAnonymous]
+// public ActionResult Login(string returnUrl)
+// {
+// ViewBag.ReturnUrl = returnUrl;
+// return View();
+// }
+
+// //
+// // POST: /Account/Login
+// [HttpPost]
+// [AllowAnonymous]
+// [ValidateAntiForgeryToken]
+// public async Task Login(LoginViewModel model, string returnUrl)
+// {
+// if (!ModelState.IsValid)
+// {
+// return View(model);
+// }
+
+// // This doesn't count login failures towards account lockout
+// // To enable password failures to trigger account lockout, change to shouldLockout: true
+// var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
+// switch (result)
+// {
+// case SignInStatus.Success:
+// return RedirectToLocal(returnUrl);
+// case SignInStatus.LockedOut:
+// return View("Lockout");
+// case SignInStatus.RequiresVerification:
+// return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
+// case SignInStatus.Failure:
+// default:
+// ModelState.AddModelError("", "Invalid login attempt.");
+// return View(model);
+// }
+// }
+
+// //
+// // GET: /Account/VerifyCode
+// [AllowAnonymous]
+// public async Task VerifyCode(string provider, string returnUrl, bool rememberMe)
+// {
+// // Require that the user has already logged in via username/password or external login
+// if (!await SignInManager.HasBeenVerifiedAsync())
+// {
+// return View("Error");
+// }
+// return View(new VerifyCodeViewModel { Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe });
+// }
+
+// //
+// // POST: /Account/VerifyCode
+// [HttpPost]
+// [AllowAnonymous]
+// [ValidateAntiForgeryToken]
+// public async Task VerifyCode(VerifyCodeViewModel model)
+// {
+// if (!ModelState.IsValid)
+// {
+// return View(model);
+// }
+
+// // The following code protects for brute force attacks against the two factor codes.
+// // If a user enters incorrect codes for a specified amount of time then the user account
+// // will be locked out for a specified amount of time.
+// // You can configure the account lockout settings in IdentityConfig
+// var result = await SignInManager.TwoFactorSignInAsync(model.Provider, model.Code, isPersistent: model.RememberMe, rememberBrowser: model.RememberBrowser);
+// switch (result)
+// {
+// case SignInStatus.Success:
+// return RedirectToLocal(model.ReturnUrl);
+// case SignInStatus.LockedOut:
+// return View("Lockout");
+// case SignInStatus.Failure:
+// default:
+// ModelState.AddModelError("", "Invalid code.");
+// return View(model);
+// }
+// }
+
+// //
+// // GET: /Account/Register
+// [AllowAnonymous]
+// public ActionResult Register()
+// {
+// return View();
+// }
+
+// //
+// // POST: /Account/Register
+// [HttpPost]
+// [AllowAnonymous]
+// [ValidateAntiForgeryToken]
+// public async Task Register(RegisterViewModel model)
+// {
+// if (ModelState.IsValid)
+// {
+// var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
+// var result = await UserManager.CreateAsync(user, model.Password);
+// if (result.Succeeded)
+// {
+// await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
+
+// // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
+// // Send an email with this link
+// // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
+// // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
+// // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking here");
+
+// return RedirectToAction("Index", "Home");
+// }
+// AddErrors(result);
+// }
+
+// // If we got this far, something failed, redisplay form
+// return View(model);
+// }
+
+// //
+// // GET: /Account/ConfirmEmail
+// [AllowAnonymous]
+// public async Task ConfirmEmail(string userId, string code)
+// {
+// if (userId == null || code == null)
+// {
+// return View("Error");
+// }
+// var result = await UserManager.ConfirmEmailAsync(userId, code);
+// return View(result.Succeeded ? "ConfirmEmail" : "Error");
+// }
+
+// //
+// // GET: /Account/ForgotPassword
+// [AllowAnonymous]
+// public ActionResult ForgotPassword()
+// {
+// return View();
+// }
+
+// //
+// // POST: /Account/ForgotPassword
+// [HttpPost]
+// [AllowAnonymous]
+// [ValidateAntiForgeryToken]
+// public async Task ForgotPassword(ForgotPasswordViewModel model)
+// {
+// if (ModelState.IsValid)
+// {
+// var user = await UserManager.FindByNameAsync(model.Email);
+// if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)))
+// {
+// // Don't reveal that the user does not exist or is not confirmed
+// return View("ForgotPasswordConfirmation");
+// }
+
+// // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
+// // Send an email with this link
+// // string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
+// // var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
+// // await UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking here");
+// // return RedirectToAction("ForgotPasswordConfirmation", "Account");
+// }
+
+// // If we got this far, something failed, redisplay form
+// return View(model);
+// }
+
+// //
+// // GET: /Account/ForgotPasswordConfirmation
+// [AllowAnonymous]
+// public ActionResult ForgotPasswordConfirmation()
+// {
+// return View();
+// }
+
+// //
+// // GET: /Account/ResetPassword
+// [AllowAnonymous]
+// public ActionResult ResetPassword(string code)
+// {
+// return code == null ? View("Error") : View();
+// }
+
+// //
+// // POST: /Account/ResetPassword
+// [HttpPost]
+// [AllowAnonymous]
+// [ValidateAntiForgeryToken]
+// public async Task ResetPassword(ResetPasswordViewModel model)
+// {
+// if (!ModelState.IsValid)
+// {
+// return View(model);
+// }
+// var user = await UserManager.FindByNameAsync(model.Email);
+// if (user == null)
+// {
+// // Don't reveal that the user does not exist
+// return RedirectToAction("ResetPasswordConfirmation", "Account");
+// }
+// var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
+// if (result.Succeeded)
+// {
+// return RedirectToAction("ResetPasswordConfirmation", "Account");
+// }
+// AddErrors(result);
+// return View();
+// }
+
+// //
+// // GET: /Account/ResetPasswordConfirmation
+// [AllowAnonymous]
+// public ActionResult ResetPasswordConfirmation()
+// {
+// return View();
+// }
+
+// //
+// // POST: /Account/ExternalLogin
+// [HttpPost]
+// [AllowAnonymous]
+// [ValidateAntiForgeryToken]
+// public ActionResult ExternalLogin(string provider, string returnUrl)
+// {
+// // Request a redirect to the external login provider
+// return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
+// }
+
+// //
+// // GET: /Account/SendCode
+// [AllowAnonymous]
+// public async Task SendCode(string returnUrl, bool rememberMe)
+// {
+// var userId = await SignInManager.GetVerifiedUserIdAsync();
+// if (userId == null)
+// {
+// return View("Error");
+// }
+// var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(userId);
+// var factorOptions = userFactors.Select(purpose => new SelectListItem { Text = purpose, Value = purpose }).ToList();
+// return View(new SendCodeViewModel { Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe });
+// }
+
+// //
+// // POST: /Account/SendCode
+// [HttpPost]
+// [AllowAnonymous]
+// [ValidateAntiForgeryToken]
+// public async Task SendCode(SendCodeViewModel model)
+// {
+// if (!ModelState.IsValid)
+// {
+// return View();
+// }
+
+// // Generate the token and send it
+// if (!await SignInManager.SendTwoFactorCodeAsync(model.SelectedProvider))
+// {
+// return View("Error");
+// }
+// return RedirectToAction("VerifyCode", new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe });
+// }
+
+// //
+// // GET: /Account/ExternalLoginCallback
+// [AllowAnonymous]
+// public async Task ExternalLoginCallback(string returnUrl)
+// {
+// var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
+// if (loginInfo == null)
+// {
+// return RedirectToAction("Login");
+// }
+
+// // Sign in the user with this external login provider if the user already has a login
+// var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
+// switch (result)
+// {
+// case SignInStatus.Success:
+// return RedirectToLocal(returnUrl);
+// case SignInStatus.LockedOut:
+// return View("Lockout");
+// case SignInStatus.RequiresVerification:
+// return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false });
+// case SignInStatus.Failure:
+// default:
+// // If the user does not have an account, then prompt the user to create an account
+// ViewBag.ReturnUrl = returnUrl;
+// ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
+// return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });
+// }
+// }
+
+// //
+// // POST: /Account/ExternalLoginConfirmation
+// [HttpPost]
+// [AllowAnonymous]
+// [ValidateAntiForgeryToken]
+// public async Task ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
+// {
+// if (User.Identity.IsAuthenticated)
+// {
+// return RedirectToAction("Index", "Manage");
+// }
+
+// if (ModelState.IsValid)
+// {
+// // Get the information about the user from the external login provider
+// var info = await AuthenticationManager.GetExternalLoginInfoAsync();
+// if (info == null)
+// {
+// return View("ExternalLoginFailure");
+// }
+// var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
+// var result = await UserManager.CreateAsync(user);
+// if (result.Succeeded)
+// {
+// result = await UserManager.AddLoginAsync(user.Id, info.Login);
+// if (result.Succeeded)
+// {
+// await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
+// return RedirectToLocal(returnUrl);
+// }
+// }
+// AddErrors(result);
+// }
+
+// ViewBag.ReturnUrl = returnUrl;
+// return View(model);
+// }
+
+// //
+// // POST: /Account/LogOff
+// [HttpPost]
+// [ValidateAntiForgeryToken]
+// public ActionResult LogOff()
+// {
+// AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
+// return RedirectToAction("Index", "Home");
+// }
+
+// //
+// // GET: /Account/ExternalLoginFailure
+// [AllowAnonymous]
+// public ActionResult ExternalLoginFailure()
+// {
+// return View();
+// }
+
+// protected override void Dispose(bool disposing)
+// {
+// if (disposing)
+// {
+// if (_userManager != null)
+// {
+// _userManager.Dispose();
+// _userManager = null;
+// }
+
+// if (_signInManager != null)
+// {
+// _signInManager.Dispose();
+// _signInManager = null;
+// }
+// }
+
+// base.Dispose(disposing);
+// }
+
+// #region Helpers
+// // Used for XSRF protection when adding external logins
+// private const string XsrfKey = "XsrfId";
+
+// private IAuthenticationManager AuthenticationManager
+// {
+// get
+// {
+// return HttpContext.GetOwinContext().Authentication;
+// }
+// }
+
+// private void AddErrors(IdentityResult result)
+// {
+// foreach (var error in result.Errors)
+// {
+// ModelState.AddModelError("", error);
+// }
+// }
+
+// private ActionResult RedirectToLocal(string returnUrl)
+// {
+// if (Url.IsLocalUrl(returnUrl))
+// {
+// return Redirect(returnUrl);
+// }
+// return RedirectToAction("Index", "Home");
+// }
+
+// internal class ChallengeResult : HttpUnauthorizedResult
+// {
+// public ChallengeResult(string provider, string redirectUri)
+// : this(provider, redirectUri, null)
+// {
+// }
+
+// public ChallengeResult(string provider, string redirectUri, string userId)
+// {
+// LoginProvider = provider;
+// RedirectUri = redirectUri;
+// UserId = userId;
+// }
+
+// public string LoginProvider { get; set; }
+// public string RedirectUri { get; set; }
+// public string UserId { get; set; }
+
+// public override void ExecuteResult(ControllerContext context)
+// {
+// var properties = new AuthenticationProperties { RedirectUri = RedirectUri };
+// if (UserId != null)
+// {
+// properties.Dictionary[XsrfKey] = UserId;
+// }
+// context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider);
+// }
+// }
+// #endregion
+// }
}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/ChooseTripController.cs b/uthTripProject/Controllers/ChooseTripController.cs
deleted file mode 100644
index 8aad939..0000000
--- a/uthTripProject/Controllers/ChooseTripController.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-namespace uthTripProject.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure;
- using System.Linq;
- using System.Reflection;
- using System.Web;
- using System.Web.Mvc;
- using AutoMapper;
- using Microsoft.AspNet.Identity.Owin;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Interfaces;
- using UthTrip.BLL.Services;
- using UthTripProject.Models;
-
- public class ChooseTripController : Controller
- {
- private IRightsService rightsService;
-
- public ChooseTripController(IRightsService iserv)
- {
- this.rightsService = iserv;
- }
-
- public ActionResult ChooseTrip(string trip_id)
- {
- int rightsId = this.rightsService.FindMaxId() + 1;
- int roleId = this.rightsService.GetAllRoles().Where(e => e.Title == "Subscriber").Select(e => e.Role_ID).First();
-
- int userId = int.Parse(this.Session["User_ID"].ToString());
- int tripId = int.Parse(trip_id);
- RightDTO rightDTO = new RightDTO(rightsId, userId, roleId, tripId);
- try
- {
- this.rightsService.CreateRights(rightDTO);
- return this.RedirectToAction("../Home/MyTrips");
- }
- catch (ArgumentNullException ex)
- {
- this.ViewBag.ErrorMessage = "Ви вже обрали цю подорож.";
- return this.RedirectToAction($"../TripDetail/TripDetail/{trip_id}");
- }
- }
- }
-}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/FaqController.cs b/uthTripProject/Controllers/FaqController.cs
deleted file mode 100644
index aaec58a..0000000
--- a/uthTripProject/Controllers/FaqController.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Web.Mvc;
-namespace UthTripProject.Controllers
-{
- public class FaqController : Controller
- {
- private readonly IFaqRepository _repository;
- public FaqController() : this(new FaqRepository()) { }
- public FaqController(IFaqRepository repository)
- {
- _repository = repository;
- }
- public ActionResult Index()
- {
- var records = _repository.GetAll();
- var model = new FaqViewModel
- {
- FAQs = records
- };
- return View(model);
- }
- }
-}
-*/
\ No newline at end of file
diff --git a/uthTripProject/Controllers/HelloController.cs b/uthTripProject/Controllers/HelloController.cs
index a4e1c68..b458747 100644
--- a/uthTripProject/Controllers/HelloController.cs
+++ b/uthTripProject/Controllers/HelloController.cs
@@ -1,29 +1,64 @@
-namespace UthTripProject.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+namespace uthTripProject.Controllers
+{
public class HelloController : Controller
{
// GET: Hello
public ActionResult Index()
{
- return this.View();
+ return View();
}
+
[HttpGet]
public ActionResult HelloPage()
{
- return this.View();
+ return View();
}
[HttpPost]
public ActionResult HelloPageAction(int a)
{
- return this.RedirectToAction("Login");
+ return RedirectToAction("Login");
}
}
-}
\ No newline at end of file
+}
+
+
+
+//namespace uthTripProject.Controllers
+//{
+// public class HelloController : Controller
+// {
+
+
+// public HelloController()
+// {
+
+
+// }
+
+// public ActionResult Index()
+// {
+// return View();
+// }
+
+// [HttpGet]
+// public ActionResult Hello()
+// {
+// return View();
+// }
+
+// [HttpPost]
+// public ActionResult Hello(TripViewModel tripModel)
+// {
+// return RedirectToAction("Login");
+// }
+
+// }
+//}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/Helper.cs b/uthTripProject/Controllers/Helper.cs
deleted file mode 100644
index d34166c..0000000
--- a/uthTripProject/Controllers/Helper.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
-using System.Web;
-
-namespace uthTripProject.Controllers
-{
- public class Helper
- {
-
- public static string strKey = "U2A9/R*41FD412+4-123";
-
- public static string Encrypt(string strData)
- {
- string strValue = " ";
- if (!string.IsNullOrEmpty(strKey))
- {
- if (strKey.Length < 16)
- {
- char c = "XXXXXXXXXXXXXXXX"[16];
- strKey = strKey + strKey.Substring(0, 16 - strKey.Length);
- }
-
- if (strKey.Length > 16)
- {
- strKey = strKey.Substring(0, 16);
- }
-
- // create encryption keys
- byte[] byteKey = Encoding.UTF8.GetBytes(strKey.Substring(0, 8));
- byte[] byteVector = Encoding.UTF8.GetBytes(strKey.Substring(strKey.Length - 8, 8));
-
- // convert data to byte array
- byte[] byteData = Encoding.UTF8.GetBytes(strData);
-
- // encrypt
- DESCryptoServiceProvider objDES = new DESCryptoServiceProvider();
- MemoryStream objMemoryStream = new MemoryStream();
- CryptoStream objCryptoStream = new CryptoStream(objMemoryStream, objDES.CreateEncryptor(byteKey, byteVector), CryptoStreamMode.Write);
- objCryptoStream.Write(byteData, 0, byteData.Length);
- objCryptoStream.FlushFinalBlock();
-
- // convert to string and Base64 encode
- strValue = Convert.ToBase64String(objMemoryStream.ToArray());
- }
- else
- {
- strValue = strData;
- }
-
- return strValue;
- }
-
- }
-
-
-
-}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/HomeController.cs b/uthTripProject/Controllers/HomeController.cs
index be5a2db..15b08ff 100644
--- a/uthTripProject/Controllers/HomeController.cs
+++ b/uthTripProject/Controllers/HomeController.cs
@@ -1,74 +1,122 @@
-namespace UthTripProject.Controllers
+using Microsoft.AspNet.Identity.Owin;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using uthTripProject.Models;
+using System.Data.Entity.Infrastructure;
+using System.Reflection;
+using AutoMapper;
+using uthTrip.BLL.Interfaces;
+using uthTrip.BLL.Services;
+using uthTrip.BLL.DTO;
+using uthTrip.BLL.Infrastructure;
+
+namespace uthTripProject.Controllers
{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure;
- using System.Linq;
- using System.Reflection;
- using System.Web;
- using System.Web.Mvc;
- using AutoMapper;
- using Microsoft.AspNet.Identity.Owin;
- using PagedList.Mvc;
- using PagedList;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.BLL.Services;
- using UthTripProject.Models;
-
public class HomeController : Controller
{
- private ITripService tripService;
-
+ ITripService tripService;
+ //public ViewResult Index()
+ //{
+ // IEnumerable destinations = tripService.GetAllDist();
+ // var countries = new SelectList((from i in destinations
+ // select i.Country).Distinct().ToList());
+
+ // ViewBag.Countries = countries;
+ // return View();
+ //}
+ //public ActionResult Index(string City)
+ //{
+
+ // IEnumerable trips = tripService.GetAll();
+ // IEnumerable destinations = tripService.GetAllDist();
+ // IEnumerable dates = tripService.GetAllDateRanges();
+ // List tripViewModels_list = new List();
+ // foreach (var trip in trips)
+ // {
+ // foreach (var destination in destinations)
+ // {
+ // if (trip.Destination_ID == destination.Destination_ID)
+ // {
+ // foreach (var date in dates)
+ // {
+ // if (trip.Destination_ID == destination.Destination_ID && trip.Date_ID == date.Date_ID)
+ // {
+ // tripViewModels_list.Add(new TripViewModel(trip, destination, date));
+ // break;
+ // }
+ // }
+ // break;
+ // }
+
+ // }
+ // }
+ // IEnumerable viewModels = tripViewModels_list;
+ // if (!String.IsNullOrEmpty(City))
+ // {
+ // viewModels = viewModels.Where(x => x.City == City);
+ // }
+ // return View(viewModels);
+ //}
public HomeController(ITripService iserv)
{
- this.tripService = iserv;
+ tripService = iserv;
}
-
- public ActionResult StartPage(int? page, string Country, string City, string maxPrice, string maxPeople)
+ public ActionResult StartPage(string Country,string City, string maxPrice, string maxPeople)
{
- IEnumerable trips = this.tripService.GetAll();
- IEnumerable destinations = this.tripService.GetAllDist();
- IEnumerable dates = this.tripService.GetAllDateRanges();
-
- List tripViewModels_list = (from trip in trips
- from destination in destinations
- from date in dates
- where trip.Destination_ID == destination.Destination_ID
- && trip.Date_ID == date.Date_ID
- select new TripViewModel(trip, destination, date)).ToList();
-
+ IEnumerable trips = tripService.GetAll();
+ IEnumerable destinations = tripService.GetAllDist();
+ IEnumerable dates = tripService.GetAllDateRanges();
+ List tripViewModels_list = new List();
+ foreach (var trip in trips)
+ {
+ foreach (var destination in destinations)
+ {
+ if (trip.Destination_ID == destination.Destination_ID)
+ {
+ foreach (var date in dates)
+ {
+ if (trip.Destination_ID == destination.Destination_ID && trip.Date_ID == date.Date_ID )
+ {
+ tripViewModels_list.Add(new TripViewModel(trip, destination, date));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
IEnumerable viewModels = tripViewModels_list;
var countries = new SelectList((from i in destinations
orderby i.Country
- select i.Country).Distinct().ToList());
- this.ViewBag.Country = countries;
+ select i.Country).Distinct().ToList());
+ ViewBag.Country = countries;
var cities = new SelectList((from i in destinations
orderby i.City
select i.City).Distinct().ToList());
- this.ViewBag.City = cities;
+ ViewBag.City = cities;
- if (!string.IsNullOrEmpty(Country) && !string.IsNullOrEmpty(City))
+ if (!String.IsNullOrEmpty(Country) && !String.IsNullOrEmpty(City))
{
- viewModels = viewModels.Where(x => x.Country == Country && x.City == City);
+ viewModels = viewModels.Where(x => x.Country == Country && x.City==City);
}
- else if (!string.IsNullOrEmpty(Country))
+ else if (!String.IsNullOrEmpty(Country) )
{
viewModels = viewModels.Where(x => x.Country == Country);
}
- else if (!string.IsNullOrEmpty(City))
+ else if (!String.IsNullOrEmpty(City))
{
viewModels = viewModels.Where(x => x.City == City);
}
-
double price;
if (double.TryParse(maxPrice, out price))
{
- viewModels = viewModels.Where(x => x.Price <= price);
+ viewModels = viewModels.Where(x => x.Price <= price);
}
int persons;
@@ -76,60 +124,13 @@ orderby i.City
{
viewModels = viewModels.Where(x => x.Number_Of_People <= persons);
}
+ return View(viewModels);
- int pageSize = 7;
- int pageNumber = page ?? 1;
-
- return this.View(viewModels.ToPagedList(pageNumber, pageSize));
}
-
public ActionResult HomeA()
{
- return this.View("Login");
- }
-
- public ActionResult MyTrips()
- {
- IEnumerable trips = this.tripService.GetAll();
- IEnumerable destinations = this.tripService.GetAllDist();
- IEnumerable dates = this.tripService.GetAllDateRanges();
- IEnumerable rights = this.tripService.GetAllRights();
- int user_id = int.Parse(this.Session["User_ID"].ToString());
-
- List tripViewModels_list = (from trip in trips
- from destination in destinations
- from date in dates
- from right in rights
- where trip.Destination_ID == destination.Destination_ID
- && trip.Date_ID == date.Date_ID
- && trip.Trip_ID == right.Trip_ID
- && right.User_ID == user_id
- && right.Role_ID == 1
- select new TripViewModel(trip, destination, date)).ToList();
-
- IEnumerable viewModels = tripViewModels_list;
-
- return this.View(viewModels);
- }
-
- public ActionResult Created()
- {
- IEnumerable trips = this.tripService.GetAll();
- IEnumerable destinations = this.tripService.GetAllDist();
- IEnumerable dates = this.tripService.GetAllDateRanges();
- int user_id = int.Parse(this.Session["User_ID"].ToString());
-
- List tripViewModels_list = (from trip in trips
- from destination in destinations
- from date in dates
- where trip.Destination_ID == destination.Destination_ID
- && trip.Date_ID == date.Date_ID
- && trip.Creator_ID == user_id
- select new TripViewModel(trip, destination, date)).ToList();
-
- IEnumerable viewModels = tripViewModels_list;
- return this.View(viewModels);
+ return View("Login");
}
}
}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/ManageController.cs b/uthTripProject/Controllers/ManageController.cs
index 9dd2289..831ed12 100644
--- a/uthTripProject/Controllers/ManageController.cs
+++ b/uthTripProject/Controllers/ManageController.cs
@@ -1,389 +1,390 @@
-namespace UthTripProject.Controllers
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web;
+using System.Web.Mvc;
+using Microsoft.AspNet.Identity;
+using Microsoft.AspNet.Identity.Owin;
+using Microsoft.Owin.Security;
+using uthTripProject.Models;
+
+namespace uthTripProject.Controllers
{
- using System;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Web;
- using System.Web.Mvc;
- using Microsoft.AspNet.Identity;
- using Microsoft.AspNet.Identity.Owin;
- using Microsoft.Owin.Security;
- using UthTripProject.Models;
- //// [Authorize]
- /* public class ManageController : Controller
- {
- private ApplicationSignInManager _signInManager;
- private ApplicationUserManager _userManager;
-
- public ManageController()
- {
- }
-
- public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager)
- {
- UserManager = userManager;
- SignInManager = signInManager;
- }
-
- public ApplicationSignInManager SignInManager
- {
- get
- {
- return _signInManager ?? HttpContext.GetOwinContext().Get();
- }
- private set
- {
- _signInManager = value;
- }
- }
-
- public ApplicationUserManager UserManager
- {
- get
- {
- return _userManager ?? HttpContext.GetOwinContext().GetUserManager();
- }
- private set
- {
- _userManager = value;
- }
- }
-
- //
- // GET: /Manage/Index
- public async Task Index(ManageMessageId? message)
- {
- ViewBag.StatusMessage =
- message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
- : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
- : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
- : message == ManageMessageId.Error ? "An error has occurred."
- : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
- : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
- : "";
-
- var userId = User.Identity.GetUserId();
- var model = new IndexViewModel
- {
- HasPassword = HasPassword(),
- PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
- TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
- Logins = await UserManager.GetLoginsAsync(userId),
- BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
- };
- return View(model);
- }
-
- //
- // POST: /Manage/RemoveLogin
- [HttpPost]
- [ValidateAntiForgeryToken]
- public async Task RemoveLogin(string loginProvider, string providerKey)
- {
- ManageMessageId? message;
- var result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey));
- if (result.Succeeded)
- {
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- if (user != null)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
- }
- message = ManageMessageId.RemoveLoginSuccess;
- }
- else
- {
- message = ManageMessageId.Error;
- }
- return RedirectToAction("ManageLogins", new { Message = message });
- }
-
- //
- // GET: /Manage/AddPhoneNumber
- public ActionResult AddPhoneNumber()
- {
- return View();
- }
-
- //
- // POST: /Manage/AddPhoneNumber
- [HttpPost]
- [ValidateAntiForgeryToken]
- public async Task AddPhoneNumber(AddPhoneNumberViewModel model)
- {
- if (!ModelState.IsValid)
- {
- return View(model);
- }
- // Generate the token and send it
- var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number);
- if (UserManager.SmsService != null)
- {
- var message = new IdentityMessage
- {
- Destination = model.Number,
- Body = "Your security code is: " + code
- };
- await UserManager.SmsService.SendAsync(message);
- }
- return RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number });
- }
-
- //
- // POST: /Manage/EnableTwoFactorAuthentication
- [HttpPost]
- [ValidateAntiForgeryToken]
- public async Task EnableTwoFactorAuthentication()
- {
- await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), true);
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- if (user != null)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
- }
- return RedirectToAction("Index", "Manage");
- }
-
- //
- // POST: /Manage/DisableTwoFactorAuthentication
- [HttpPost]
- [ValidateAntiForgeryToken]
- public async Task DisableTwoFactorAuthentication()
- {
- await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), false);
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- if (user != null)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
- }
- return RedirectToAction("Index", "Manage");
- }
-
- //
- // GET: /Manage/VerifyPhoneNumber
- public async Task VerifyPhoneNumber(string phoneNumber)
- {
- var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), phoneNumber);
- // Send an SMS through the SMS provider to verify the phone number
- return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
- }
-
- //
- // POST: /Manage/VerifyPhoneNumber
- [HttpPost]
- [ValidateAntiForgeryToken]
- public async Task VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
- {
- if (!ModelState.IsValid)
- {
- return View(model);
- }
- var result = await UserManager.ChangePhoneNumberAsync(User.Identity.GetUserId(), model.PhoneNumber, model.Code);
- if (result.Succeeded)
- {
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- if (user != null)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
- }
- return RedirectToAction("Index", new { Message = ManageMessageId.AddPhoneSuccess });
- }
- // If we got this far, something failed, redisplay form
- ModelState.AddModelError("", "Failed to verify phone");
- return View(model);
- }
-
- //
- // POST: /Manage/RemovePhoneNumber
- [HttpPost]
- [ValidateAntiForgeryToken]
- public async Task RemovePhoneNumber()
- {
- var result = await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), null);
- if (!result.Succeeded)
- {
- return RedirectToAction("Index", new { Message = ManageMessageId.Error });
- }
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- if (user != null)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
- }
- return RedirectToAction("Index", new { Message = ManageMessageId.RemovePhoneSuccess });
- }
-
- //
- // GET: /Manage/ChangePassword
- public ActionResult ChangePassword()
- {
- return View();
- }
-
- //
- // POST: /Manage/ChangePassword
- [HttpPost]
- [ValidateAntiForgeryToken]
- public async Task ChangePassword(ChangePasswordViewModel model)
- {
- if (!ModelState.IsValid)
- {
- return View(model);
- }
- var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);
- if (result.Succeeded)
- {
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- if (user != null)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
- }
- return RedirectToAction("Index", new { Message = ManageMessageId.ChangePasswordSuccess });
- }
- AddErrors(result);
- return View(model);
- }
-
- //
- // GET: /Manage/SetPassword
- public ActionResult SetPassword()
- {
- return View();
- }
-
- //
- // POST: /Manage/SetPassword
- [HttpPost]
- [ValidateAntiForgeryToken]
- public async Task SetPassword(SetPasswordViewModel model)
- {
- if (ModelState.IsValid)
- {
- var result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
- if (result.Succeeded)
- {
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- if (user != null)
- {
- await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
- }
- return RedirectToAction("Index", new { Message = ManageMessageId.SetPasswordSuccess });
- }
- AddErrors(result);
- }
-
- // If we got this far, something failed, redisplay form
- return View(model);
- }
-
- //
- // GET: /Manage/ManageLogins
- public async Task ManageLogins(ManageMessageId? message)
- {
- ViewBag.StatusMessage =
- message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
- : message == ManageMessageId.Error ? "An error has occurred."
- : "";
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- if (user == null)
- {
- return View("Error");
- }
- var userLogins = await UserManager.GetLoginsAsync(User.Identity.GetUserId());
- var otherLogins = AuthenticationManager.GetExternalAuthenticationTypes().Where(auth => userLogins.All(ul => auth.AuthenticationType != ul.LoginProvider)).ToList();
- ViewBag.ShowRemoveButton = user.PasswordHash != null || userLogins.Count > 1;
- return View(new ManageLoginsViewModel
- {
- CurrentLogins = userLogins,
- OtherLogins = otherLogins
- });
- }
-
- //
- // POST: /Manage/LinkLogin
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult LinkLogin(string provider)
- {
- // Request a redirect to the external login provider to link a login for the current user
- return new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId());
- }
-
- //
- // GET: /Manage/LinkLoginCallback
- public async Task LinkLoginCallback()
- {
- var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId());
- if (loginInfo == null)
- {
- return RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error });
- }
- var result = await UserManager.AddLoginAsync(User.Identity.GetUserId(), loginInfo.Login);
- return result.Succeeded ? RedirectToAction("ManageLogins") : RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error });
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing && _userManager != null)
- {
- _userManager.Dispose();
- _userManager = null;
- }
-
- base.Dispose(disposing);
- }
-
- #region Helpers
- // Used for XSRF protection when adding external logins
- private const string XsrfKey = "XsrfId";
-
- private IAuthenticationManager AuthenticationManager
- {
- get
- {
- return HttpContext.GetOwinContext().Authentication;
- }
- }
-
- private void AddErrors(IdentityResult result)
- {
- foreach (var error in result.Errors)
- {
- ModelState.AddModelError("", error);
- }
- }
-
- private bool HasPassword()
- {
- var user = UserManager.FindById(User.Identity.GetUserId());
- if (user != null)
- {
- return user.PasswordHash != null;
- }
- return false;
- }
-
- private bool HasPhoneNumber()
- {
- var user = UserManager.FindById(User.Identity.GetUserId());
- if (user != null)
- {
- return user.PhoneNumber != null;
- }
- return false;
- }
-
- public enum ManageMessageId
- {
- AddPhoneSuccess,
- ChangePasswordSuccess,
- SetTwoFactorSuccess,
- SetPasswordSuccess,
- RemoveLoginSuccess,
- RemovePhoneSuccess,
- Error
- }
-
- #endregion
- }
- */
+ // [Authorize]
+ /* public class ManageController : Controller
+ {
+ private ApplicationSignInManager _signInManager;
+ private ApplicationUserManager _userManager;
+
+ public ManageController()
+ {
+ }
+
+ public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager)
+ {
+ UserManager = userManager;
+ SignInManager = signInManager;
+ }
+
+ public ApplicationSignInManager SignInManager
+ {
+ get
+ {
+ return _signInManager ?? HttpContext.GetOwinContext().Get();
+ }
+ private set
+ {
+ _signInManager = value;
+ }
+ }
+
+ public ApplicationUserManager UserManager
+ {
+ get
+ {
+ return _userManager ?? HttpContext.GetOwinContext().GetUserManager();
+ }
+ private set
+ {
+ _userManager = value;
+ }
+ }
+
+ //
+ // GET: /Manage/Index
+ public async Task Index(ManageMessageId? message)
+ {
+ ViewBag.StatusMessage =
+ message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
+ : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
+ : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
+ : message == ManageMessageId.Error ? "An error has occurred."
+ : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
+ : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
+ : "";
+
+ var userId = User.Identity.GetUserId();
+ var model = new IndexViewModel
+ {
+ HasPassword = HasPassword(),
+ PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
+ TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
+ Logins = await UserManager.GetLoginsAsync(userId),
+ BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
+ };
+ return View(model);
+ }
+
+ //
+ // POST: /Manage/RemoveLogin
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public async Task RemoveLogin(string loginProvider, string providerKey)
+ {
+ ManageMessageId? message;
+ var result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey));
+ if (result.Succeeded)
+ {
+ var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
+ if (user != null)
+ {
+ await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
+ }
+ message = ManageMessageId.RemoveLoginSuccess;
+ }
+ else
+ {
+ message = ManageMessageId.Error;
+ }
+ return RedirectToAction("ManageLogins", new { Message = message });
+ }
+
+ //
+ // GET: /Manage/AddPhoneNumber
+ public ActionResult AddPhoneNumber()
+ {
+ return View();
+ }
+
+ //
+ // POST: /Manage/AddPhoneNumber
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public async Task AddPhoneNumber(AddPhoneNumberViewModel model)
+ {
+ if (!ModelState.IsValid)
+ {
+ return View(model);
+ }
+ // Generate the token and send it
+ var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number);
+ if (UserManager.SmsService != null)
+ {
+ var message = new IdentityMessage
+ {
+ Destination = model.Number,
+ Body = "Your security code is: " + code
+ };
+ await UserManager.SmsService.SendAsync(message);
+ }
+ return RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number });
+ }
+
+ //
+ // POST: /Manage/EnableTwoFactorAuthentication
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public async Task EnableTwoFactorAuthentication()
+ {
+ await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), true);
+ var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
+ if (user != null)
+ {
+ await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
+ }
+ return RedirectToAction("Index", "Manage");
+ }
+
+ //
+ // POST: /Manage/DisableTwoFactorAuthentication
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public async Task DisableTwoFactorAuthentication()
+ {
+ await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), false);
+ var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
+ if (user != null)
+ {
+ await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
+ }
+ return RedirectToAction("Index", "Manage");
+ }
+
+ //
+ // GET: /Manage/VerifyPhoneNumber
+ public async Task VerifyPhoneNumber(string phoneNumber)
+ {
+ var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), phoneNumber);
+ // Send an SMS through the SMS provider to verify the phone number
+ return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
+ }
+
+ //
+ // POST: /Manage/VerifyPhoneNumber
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public async Task VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
+ {
+ if (!ModelState.IsValid)
+ {
+ return View(model);
+ }
+ var result = await UserManager.ChangePhoneNumberAsync(User.Identity.GetUserId(), model.PhoneNumber, model.Code);
+ if (result.Succeeded)
+ {
+ var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
+ if (user != null)
+ {
+ await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
+ }
+ return RedirectToAction("Index", new { Message = ManageMessageId.AddPhoneSuccess });
+ }
+ // If we got this far, something failed, redisplay form
+ ModelState.AddModelError("", "Failed to verify phone");
+ return View(model);
+ }
+
+ //
+ // POST: /Manage/RemovePhoneNumber
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public async Task RemovePhoneNumber()
+ {
+ var result = await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), null);
+ if (!result.Succeeded)
+ {
+ return RedirectToAction("Index", new { Message = ManageMessageId.Error });
+ }
+ var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
+ if (user != null)
+ {
+ await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
+ }
+ return RedirectToAction("Index", new { Message = ManageMessageId.RemovePhoneSuccess });
+ }
+
+ //
+ // GET: /Manage/ChangePassword
+ public ActionResult ChangePassword()
+ {
+ return View();
+ }
+
+ //
+ // POST: /Manage/ChangePassword
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public async Task ChangePassword(ChangePasswordViewModel model)
+ {
+ if (!ModelState.IsValid)
+ {
+ return View(model);
+ }
+ var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);
+ if (result.Succeeded)
+ {
+ var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
+ if (user != null)
+ {
+ await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
+ }
+ return RedirectToAction("Index", new { Message = ManageMessageId.ChangePasswordSuccess });
+ }
+ AddErrors(result);
+ return View(model);
+ }
+
+ //
+ // GET: /Manage/SetPassword
+ public ActionResult SetPassword()
+ {
+ return View();
+ }
+
+ //
+ // POST: /Manage/SetPassword
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public async Task SetPassword(SetPasswordViewModel model)
+ {
+ if (ModelState.IsValid)
+ {
+ var result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
+ if (result.Succeeded)
+ {
+ var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
+ if (user != null)
+ {
+ await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
+ }
+ return RedirectToAction("Index", new { Message = ManageMessageId.SetPasswordSuccess });
+ }
+ AddErrors(result);
+ }
+
+ // If we got this far, something failed, redisplay form
+ return View(model);
+ }
+
+ //
+ // GET: /Manage/ManageLogins
+ public async Task ManageLogins(ManageMessageId? message)
+ {
+ ViewBag.StatusMessage =
+ message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
+ : message == ManageMessageId.Error ? "An error has occurred."
+ : "";
+ var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
+ if (user == null)
+ {
+ return View("Error");
+ }
+ var userLogins = await UserManager.GetLoginsAsync(User.Identity.GetUserId());
+ var otherLogins = AuthenticationManager.GetExternalAuthenticationTypes().Where(auth => userLogins.All(ul => auth.AuthenticationType != ul.LoginProvider)).ToList();
+ ViewBag.ShowRemoveButton = user.PasswordHash != null || userLogins.Count > 1;
+ return View(new ManageLoginsViewModel
+ {
+ CurrentLogins = userLogins,
+ OtherLogins = otherLogins
+ });
+ }
+
+ //
+ // POST: /Manage/LinkLogin
+ [HttpPost]
+ [ValidateAntiForgeryToken]
+ public ActionResult LinkLogin(string provider)
+ {
+ // Request a redirect to the external login provider to link a login for the current user
+ return new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId());
+ }
+
+ //
+ // GET: /Manage/LinkLoginCallback
+ public async Task LinkLoginCallback()
+ {
+ var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId());
+ if (loginInfo == null)
+ {
+ return RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error });
+ }
+ var result = await UserManager.AddLoginAsync(User.Identity.GetUserId(), loginInfo.Login);
+ return result.Succeeded ? RedirectToAction("ManageLogins") : RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error });
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && _userManager != null)
+ {
+ _userManager.Dispose();
+ _userManager = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+#region Helpers
+ // Used for XSRF protection when adding external logins
+ private const string XsrfKey = "XsrfId";
+
+ private IAuthenticationManager AuthenticationManager
+ {
+ get
+ {
+ return HttpContext.GetOwinContext().Authentication;
+ }
+ }
+
+ private void AddErrors(IdentityResult result)
+ {
+ foreach (var error in result.Errors)
+ {
+ ModelState.AddModelError("", error);
+ }
+ }
+
+ private bool HasPassword()
+ {
+ var user = UserManager.FindById(User.Identity.GetUserId());
+ if (user != null)
+ {
+ return user.PasswordHash != null;
+ }
+ return false;
+ }
+
+ private bool HasPhoneNumber()
+ {
+ var user = UserManager.FindById(User.Identity.GetUserId());
+ if (user != null)
+ {
+ return user.PhoneNumber != null;
+ }
+ return false;
+ }
+
+ public enum ManageMessageId
+ {
+ AddPhoneSuccess,
+ ChangePasswordSuccess,
+ SetTwoFactorSuccess,
+ SetPasswordSuccess,
+ RemoveLoginSuccess,
+ RemovePhoneSuccess,
+ Error
+ }
+
+#endregion
+ }
+ */
}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/ReviewController.cs b/uthTripProject/Controllers/ReviewController.cs
deleted file mode 100644
index d76150b..0000000
--- a/uthTripProject/Controllers/ReviewController.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-namespace uthTripProject.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure;
- using System.Linq;
- using System.Reflection;
- using System.Web;
- using System.Web.Mvc;
- using AutoMapper;
- using Microsoft.AspNet.Identity.Owin;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.BLL.Services;
- using UthTripProject.Models;
-
- public class ReviewController : Controller
- {
- private IReviewService reviewService;
-
- private int tripId;
-
- public ReviewController(IReviewService iserv)
- {
- this.reviewService = iserv;
- }
-
- [HttpGet]
- public ActionResult WriteReview(int? id)
- {
- if (this.Session["User_ID"] == null)
- {
- return this.RedirectToAction("../User/Login");
- }
- else
- {
- this.tripId = (int)id;
- ReviewViewModel reviewModel = new ReviewViewModel();
- return this.View(reviewModel);
- }
- }
-
- [HttpPost]
- public ActionResult WriteReview(int id, ReviewViewModel reviewViewModel)
- {
- ////TO DO: change this
- reviewViewModel.Review_ID = this.reviewService.FindMaxId()+1;
- reviewViewModel.Writer_ID = int.Parse(this.Session["User_ID"].ToString());
- reviewViewModel.Trip_ID = id;
-
- var reviewDto = new ReviewDTO(reviewViewModel.Review_ID, reviewViewModel.Writer_ID, reviewViewModel.Trip_ID, reviewViewModel.Review1, reviewViewModel.Mark);
- this.reviewService.CreateReview(reviewDto);
-
- int creator_id = this.reviewService.GetAllTrips().Where(t => t.Trip_ID == id).Select(t => t.Creator_ID).FirstOrDefault();
- return this.RedirectToAction($"../User/UserProfile/{creator_id}");
- }
- }
-}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/TripController.cs b/uthTripProject/Controllers/TripController.cs
index e6c0452..91fb24a 100644
--- a/uthTripProject/Controllers/TripController.cs
+++ b/uthTripProject/Controllers/TripController.cs
@@ -1,42 +1,41 @@
-namespace UthTripProject.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure;
- using System.Linq;
- using System.Reflection;
- using System.Web;
- using System.Web.Mvc;
- using AutoMapper;
- using Microsoft.AspNet.Identity.Owin;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using UthTrip.BLL.Services;
- using UthTripProject.Models;
+using Microsoft.AspNet.Identity.Owin;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using uthTripProject.Models;
+using System.Data.Entity.Infrastructure;
+using System.Reflection;
+using AutoMapper;
+using uthTrip.BLL.Interfaces;
+using uthTrip.BLL.Services;
+using uthTrip.BLL.DTO;
+using uthTrip.BLL.Infrastructure;
+namespace uthTripProject.Controllers
+{
public class TripController : Controller
{
- private ITripService tripService;
+ ITripService tripService;
public TripController(ITripService iserv)
{
- this.tripService = iserv;
- }
+ tripService = iserv;
+ }
public ActionResult Index()
{
- IEnumerable tripDtos = this.tripService.GetAll();
+ IEnumerable tripDtos = tripService.GetAll();
var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
var trips = mapper.Map, List>(tripDtos);
- return this.View(trips);
+ return View(trips);
}
-
[HttpGet]
public ActionResult Create(int id = 0)
{
TripViewModel tripModel = new TripViewModel();
- return this.View(tripModel);
+ return View(tripModel);
}
[HttpPost]
@@ -44,40 +43,29 @@ public ActionResult Create(TripViewModel tripModel)
{
try
{
- tripModel.Trip_ID = this.tripService.FindMaxId() + 1;
- tripModel.Destination_ID = this.tripService.FindMaxIdDestination() + 1;
- tripModel.Date_ID = this.tripService.FindMaxIdDateRange() + 1;
- switch (tripModel.Country.ToLower())
- {
- case "ukraine":
- tripModel.Is_Abroad = false;
- break;
- default:
- tripModel.Is_Abroad = true;
- break;
- }
-
- var sessionUserId = int.Parse(this.Session["User_ID"].ToString());
- tripModel.Creator_ID = sessionUserId;
+ tripModel.Trip_ID = tripService.FindMaxId() + 1;
+ tripModel.Destination_ID = tripService.FindMaxIdDestination()+1;
+ tripModel.Date_ID = tripService.FindMaxIdDateRange()+1;
+ tripModel.Creator_ID = 37;
var tripDto = new TripDTO(tripModel.Trip_ID, tripModel.Trip_Title, tripModel.Description, tripModel.Price, tripModel.Date_ID, tripModel.Number_Of_People, tripModel.Destination_ID, tripModel.Creator_ID);
var destinationDto = new DestinationDTO(tripModel.Destination_ID, tripModel.Is_Abroad, tripModel.Country, tripModel.City);
var dateDto = new DatesRangeDTO(tripModel.Date_ID, tripModel.Start_date, tripModel.End_date);
- this.tripService.CreateTrip(tripDto, destinationDto, dateDto);
- return this.RedirectToAction("TripDetail", "TripDetail", new { id = tripModel.Trip_ID });
- }
- catch (ArgumentNullException)
- {
- this.ViewBag.DuplicateMessage = "Подорож з цією назвою вже існує.";
- return this.View("Create");
+ tripService.CreateTrip(tripDto,destinationDto,dateDto);
+
+ ViewBag.SuccessMessage = "Successfull creation of trip.";
}
- catch (System.Data.Entity.Validation.DbEntityValidationException)
+ catch (ValidationException ex)
{
- this.ModelState.Clear();
- this.ViewBag.DuplicateMessage = "Неправильне ім'я користувача або пароль.";
+ ModelState.AddModelError(ex.Property, ex.Message);
+ ModelState.Clear();
+ ViewBag.DuplicateMessage = "Trip with this name already exists.";
+ return View("Create", tripModel);
- return this.View("Create", tripModel);
}
+ ModelState.Clear();
+ return View("Create", new TripViewModel());
}
+
}
}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/TripDetailController.cs b/uthTripProject/Controllers/TripDetailController.cs
deleted file mode 100644
index 936ea72..0000000
--- a/uthTripProject/Controllers/TripDetailController.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-namespace UthTripProject.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure;
- using System.Linq;
- using System.Reflection;
- using System.Web;
- using System.Web.Mvc;
- using AutoMapper;
- using Microsoft.AspNet.Identity.Owin;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Interfaces;
- using UthTrip.BLL.Services;
- using UthTripProject.Models;
-
- public class TripDetailController : Controller
- {
- private ITripService tripService;
-
- public TripDetailController(ITripService iserv)
- {
- this.tripService = iserv;
- }
-
- public ActionResult TripDetail(int? id)
- {
- ////if (id == null)
- ////{
- //// return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
- ////}
- IEnumerable trips = this.tripService.GetAll();
- IEnumerable destinations = this.tripService.GetAllDist();
- IEnumerable dates = this.tripService.GetAllDateRanges();
- List tripViewModels_list = new List();
- foreach (var t in trips)
- {
- foreach (var destination in destinations)
- {
- if (t.Destination_ID == destination.Destination_ID)
- {
- foreach (var date in dates)
- {
- if ( t.Date_ID == date.Date_ID)
- {
- tripViewModels_list.Add(new TripViewModel(t, destination, date));
- break;
- }
- }
-
- break;
- }
- }
- }
-
- IEnumerable viewModels = tripViewModels_list;
- viewModels = viewModels.Where(x => x.Trip_ID == id);
- TripViewModel tripViewModel = viewModels.First();
- int PlacesWas= tripViewModel.Number_Of_People;
- int Subscriber=0;
- IEnumerable rights = this.tripService.GetAllRights();
- foreach (var i in rights)
- {
- if (i.Trip_ID == id)
- {
- Subscriber += 1;
- }
-
- }
- IEnumerable users = this.tripService.GetAllUsers();
- Dictionary peopleList = new Dictionary();
- int FreePlaces = PlacesWas - Subscriber;
- foreach (var i in rights)
- {
- if (i.Trip_ID == id)
- {
- foreach (var ii in users)
- {
- if(ii.User_ID==i.User_ID)
- {
- peopleList[ii.User_ID]=ii.First_Name;
-
- }
- }
- }
- }
- ViewBag.Subscribers_user= peopleList;
- ViewBag.freePlaces = FreePlaces;
- ////TripDTO trip = tripService.GetById(id);
- return this.View(tripViewModel);
- }
-
-
- }
-}
\ No newline at end of file
diff --git a/uthTripProject/Controllers/UserController.cs b/uthTripProject/Controllers/UserController.cs
index e58f362..580c8a8 100644
--- a/uthTripProject/Controllers/UserController.cs
+++ b/uthTripProject/Controllers/UserController.cs
@@ -1,204 +1,142 @@
-using Microsoft.Owin.Security.Facebook;
-
-namespace UthTripProject.Controllers
+using Microsoft.AspNet.Identity.Owin;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using uthTripProject.Models;
+using System.Data.Entity.Infrastructure;
+using System.Reflection;
+using AutoMapper;
+using uthTrip.BLL.Interfaces;
+using uthTrip.BLL.DTO;
+using uthTrip.BLL.Infrastructure;
+
+namespace uthTripProject.Controllers
{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Security.Cryptography;
- using System.Text;
- using System.Web;
- using System.Web.Helpers;
- using System.Web.Mvc;
- using AutoMapper;
- using Microsoft.AspNet.Identity.Owin;
- using UthTrip.BLL.DTO;
- using UthTrip.BLL.Infrastructure;
- using UthTrip.BLL.Interfaces;
- using uthTripProject.Controllers;
- using UthTripProject.Models;
-
public class UserController : Controller
{
- private IUserService userService;
-
+ IUserService userService;
public UserController(IUserService serv)
{
- this.userService = serv;
+ userService = serv;
}
-
public ActionResult Index()
{
- IEnumerable userDtos = this.userService.GetAll();
+ IEnumerable userDtos = userService.GetAll();
var mapper = new MapperConfiguration(cfg => cfg.CreateMap()).CreateMapper();
var users = mapper.Map, List>(userDtos);
- if (users.Count > 0)
- {
- this.ViewBag.Message = string.Format("В базі даних {0} об'єкт", users.Count);
- }
-
- return this.View(users);
+ return View(users);
}
-
[HttpGet]
- public ActionResult Register(int id = 0)
+ public ActionResult AddOrEdit(int id=0)
{
UserViewModel userModel = new UserViewModel();
- return this.View(userModel);
+ return View(userModel);
}
-
[HttpPost]
- public ActionResult Register(UserViewModel userModel)
+ public ActionResult AddOrEdit(UserViewModel userModel)
{
try
{
- userModel.User_ID = this.userService.FindMaxId() + 1;
- userModel.Password = Helper.Encrypt(userModel.Password);
+<<<<<<< Updated upstream
+ userModel.User_ID = userService.FindMaxId() + 1;
var userDto = new UserDTO(userModel.User_ID, userModel.First_Name, userModel.Last_Name, userModel.Email, userModel.Username, userModel.Password, userModel.Birthday, userModel.Photo_Url, userModel.Info);
- this.userService.CreateUser(userDto);
- this.Session["User_ID"] = userDto.User_ID.ToString();
- this.Session["Username"] = userDto.Username.ToString();
- this.Session["Password"] = userDto.Password.ToString();
- return this.RedirectToAction("StartPage", "Home");
+ userService.CreateUser(userDto);
+ ViewBag.SuccessMessage = "Registration Successful.";
+
+=======
+
+ userModel.User_ID = this.userService.FindMaxId() + 1;
+ var userDto = new UserDTO(userModel.User_ID, userModel.First_Name, userModel.Last_Name, userModel.Email, userModel.Username, userModel.Password, userModel.Birthday, userModel.Photo_Url, userModel.Info);
+ this.userService.CreateUser(userDto);
+ return this.RedirectToAction("StartPage", "Home");
+
+>>>>>>> Stashed changes
}
- catch (ArgumentNullException ex)
+ catch (ValidationException ex)
{
- this.ViewBag.DuplicateMessage = "Таке і'мя користувача вже існує.";
- return this.View("Register");
+ ModelState.AddModelError(ex.Property, ex.Message);
+ ModelState.Clear();
+ ViewBag.DuplicateMessage = "Username already exists.";
+ return View("AddOrEdit", userModel);
}
+ ModelState.Clear();
+ return View("AddOrEdit", new UserViewModel());
}
-
[HttpGet]
public ActionResult Login()
{
- return this.View();
+ return View();
}
-
+<<<<<<< HEAD
+<<<<<<< HEAD
+ //public ActionResult Account(int id)
+ //{
+ // var userAccount = userService.Get(id);
+=======
public ActionResult Account(int id)
{
- var userAccount = this.userService.Get(id);
+ var userAccount = userService.Get(id);
+>>>>>>> parent of aa645ae... added unit tests for userservice
+
var viewModel = new UserViewModel
{
User_ID = userAccount.User_ID,
- First_Name = userAccount.First_Name,
+ First_Name = userAccount.First_Name,
Last_Name = userAccount.Last_Name,
Username = userAccount.Username,
Email = userAccount.Email,
- Password = userAccount.Email,
+ Password = userAccount.Password,
Birthday = userAccount.Birthday,
Photo_Url = userAccount.Photo_Url,
- Info = userAccount.Info,
+ Info = userAccount.Info
};
- return this.View(viewModel);
- }
+<<<<<<< HEAD
+ // return View(viewModel);
+ //}
+=======
+>>>>>>> parent of 3e60396... added unit tests to userservice
+=======
+ return View(viewModel);
+ }
+>>>>>>> parent of aa645ae... added unit tests for userservice
[HttpPost]
public ActionResult Login(UserViewModel userModel)
{
- this.ModelState.Clear();
- var obj = this.userService.GetByUsernamePassword(userModel.Username, userModel.Password);
- if (obj != null && userModel.Username == "admin" && userModel.Password == "admin")
- {
- this.Session["isAdmin"] = "true";
- this.Session["User_ID"] = obj.User_ID.ToString();
- this.Session["Username"] = obj.Username.ToString();
- this.Session["Password"] = obj.Password.ToString();
- return this.RedirectToAction("StartPage", "Home");
- }
- else if (obj != null)
- {
- this.Session["User_ID"] = obj.User_ID.ToString();
- this.Session["Username"] = obj.Username.ToString();
- this.Session["Password"] = obj.Password.ToString();
- return this.RedirectToAction("StartPage", "Home");
- }
- else
- {
- this.ViewBag.DuplicateMessage = "Неправильне і'мя користувача або пароль.";
- return this.View("Login");
- }
- }
- public ActionResult LogOut()
- {
- this.Session["User_ID"] = null;
- this.Session["Username"] = null;
- this.Session["Password"] = null;
- return this.View("Login");
- }
-
- public ActionResult UserProfile(int? id)
- {
- IEnumerable users = this.userService.GetAll();
- var person = (from i in users
- where i.User_ID == id
- select i).ToList().First();
- List userTrips = this.userService.GetAllTrips().Where(e => e.Creator_ID == id).Select(e => e.Trip_ID).ToList();
- var reviews = this.userService.GetAllReviews().Where(e => userTrips.Contains(e.Trip_ID)).Select(e => e.Review1);
+ //if (ModelState.IsValid)
+ //{
+ ModelState.Clear();
+ var obj = userService.GetByUsernamePassword(userModel.Username,userModel.Password);
+ if (obj != null)
+ {
+ Session["User_ID"] = obj.User_ID.ToString();
+ Session["Username"] = obj.Username.ToString();
+ Session["Password"] = obj.Password.ToString();
+ return RedirectToAction("UserDashBoard");
+ }
+ return RedirectToAction("UserDashBoard");
+ //}
- this.ViewBag.Reviews = reviews.ToList();
- return this.View(person);
+ //return View(userModel);
}
- public ActionResult AllUsers()
+ public ActionResult UserDashBoard()
{
- IEnumerable users = this.userService.GetAll();
- IEnumerable blockedUsers = this.userService.GetAllBlocked();
- List userBlockedModels = new List();
- if (blockedUsers != null)
+ if (Session["User_ID"] != null)
{
- foreach (var item in users)
- {
- bool found = false;
- foreach (var bl in blockedUsers)
- {
- if (item.User_ID == bl.User_ID)
- {
- userBlockedModels.Add(new UserBlockedModel(item.User_ID, item.First_Name, item.Last_Name, item.Email,
- item.Username, item.Password, item.Birthday, item.Photo_Url, item.Info, true));
- found = true;
- break;
- }
- }
-
- if (found == false)
- {
- userBlockedModels.Add(new UserBlockedModel(item.User_ID, item.First_Name, item.Last_Name, item.Email,
- item.Username, item.Password, item.Birthday, item.Photo_Url, item.Info, false));
- }
- }
+ return View("UserHome");
}
else
{
- foreach (var u in users)
- {
- userBlockedModels.Add(new UserBlockedModel(u.User_ID, u.First_Name, u.Last_Name, u.Email,
- u.Username, u.Password, u.Birthday, u.Photo_Url, u.Info, false));
- }
+ ViewBag.DuplicateMessage = "Incorrect username or password.";
+ return View("Login");
}
-
- return this.View(userBlockedModels);
- }
-
- public ActionResult Block(int id)
- {
- int bl_id = this.userService.FindMaxIdBl()+1;
- BlockedUsersDTO blockedUsersDTO = new BlockedUsersDTO(bl_id, id);
- this.userService.CreateBlocked(blockedUsersDTO);
- return this.RedirectToAction("AllUsers");
- }
-
- public ActionResult Unblock(int id)
- {
- int id_ = this.userService.GetAllBlocked().Where(e => e.User_ID == id).Select(e => e.Blocked_ID).First();
- this.userService.DisposeBlocked(id_);
- return this.RedirectToAction("AllUsers");
- }
+ }
}
}
\ No newline at end of file
diff --git a/uthTripProject/Global.asax b/uthTripProject/Global.asax
index b027764..b7ed2c8 100644
--- a/uthTripProject/Global.asax
+++ b/uthTripProject/Global.asax
@@ -1 +1 @@
-<%@ Application Codebehind="Global.asax.cs" Inherits="UthTripProject.MvcApplication" Language="C#" %>
+<%@ Application Codebehind="Global.asax.cs" Inherits="uthTripProject.MvcApplication" Language="C#" %>
diff --git a/uthTripProject/Global.asax.cs b/uthTripProject/Global.asax.cs
index 97c5fe5..8342ef6 100644
--- a/uthTripProject/Global.asax.cs
+++ b/uthTripProject/Global.asax.cs
@@ -1,18 +1,18 @@
-namespace UthTripProject
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Web.Optimization;
- using System.Web.Routing;
- using Ninject;
- using Ninject.Modules;
- using Ninject.Web.Mvc;
- using UthTrip.BLL.Infrastructure;
- using UthTripProject.Util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Optimization;
+using System.Web.Routing;
+using Ninject;
+using Ninject.Modules;
+using Ninject.Web.Mvc;
+using uthTrip.BLL.Infrastructure;
+using uthTripProject.Util;
+namespace uthTripProject
+{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
@@ -24,11 +24,25 @@ protected void Application_Start()
NinjectModule serviceModule = new ServiceModule("DefaultConnection");
- NinjectModule tripModule = new UthTripModule();
+ //NinjectModule userModule = new UserModule();
+ //var kernel = new StandardKernel(userModule, serviceModule);
+ //DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
+
+ //comment next 3 lines to make 'AddOrEdit' work
+
+ NinjectModule tripModule = new TripModule();
var kernelTrip = new StandardKernel(tripModule, serviceModule);
DependencyResolver.SetResolver(new NinjectDependencyResolver(kernelTrip));
AreaRegistration.RegisterAllAreas();
+
+ //NinjectModule destinationModule = new DestinationModule();
+ //var kernelDestin = new StandardKernel(destinationModule, serviceModule);
+ //DependencyResolver.SetResolver(new NinjectDependencyResolver(kernelDestin));
+
+ //NinjectModule daterangeModule = new DateRangesModule();
+ //var kernelDateRange = new StandardKernel(daterangeModule, serviceModule);
+ //DependencyResolver.SetResolver(new NinjectDependencyResolver(kernelDateRange));
}
}
}
diff --git a/uthTripProject/Models/ReviewViewModel.cs b/uthTripProject/Models/ReviewViewModel.cs
deleted file mode 100644
index 2605707..0000000
--- a/uthTripProject/Models/ReviewViewModel.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-namespace UthTripProject.Models
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using UthTrip.BLL.DTO;
-
- public class ReviewViewModel
- {
- public ReviewViewModel()
- {
- }
-
- public ReviewViewModel(int review_ID, int writer_ID, int trip_ID, string review1, int? mark)
- {
- this.Review_ID = review_ID;
- this.Writer_ID = writer_ID;
- this.Trip_ID = trip_ID;
- this.Review1 = review1;
- this.Mark = mark;
- }
-
- public int Review_ID { get; set; }
-
- public int Writer_ID { get; set; }
-
- public int Trip_ID { get; set; }
-
- [DisplayName("Відгук")]
- public string Review1 { get; set; }
-
- public int? Mark { get; set; }
- }
-}
diff --git a/uthTripProject/Models/TripViewModel.cs b/uthTripProject/Models/TripViewModel.cs
index 554b6bb..0f50b1a 100644
--- a/uthTripProject/Models/TripViewModel.cs
+++ b/uthTripProject/Models/TripViewModel.cs
@@ -1,80 +1,77 @@
-namespace UthTripProject.Models
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using UthTrip.BLL.DTO;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using uthTrip.BLL.DTO;
+namespace uthTripProject.Models
+{
public class TripViewModel
{
public TripViewModel()
{
- }
+ }
public TripViewModel(TripDTO trip, DestinationDTO destination, DatesRangeDTO datesRange)
{
- this.Trip_ID = trip.Trip_ID;
- this.Trip_Title = trip.Trip_Title;
- this.Description = trip.Description;
- this.Price = trip.Price;
- this.Date_ID = trip.Date_ID;
- this.Number_Of_People = trip.Number_Of_People;
- this.Creator_ID = trip.Creator_ID;
- this.Start_date = datesRange.Start_date;
- this.End_date = datesRange.End_date;
- this.Destination_ID = trip.Destination_ID;
- this.Is_Abroad = destination.Is_Abroad;
- this.Country = destination.Country;
- this.City = destination.City;
+ Trip_ID = trip.Trip_ID;
+ Trip_Title = trip.Trip_Title;
+ Description = trip.Description;
+ Price = trip.Price;
+ Date_ID = trip.Date_ID;
+ Number_Of_People = trip.Number_Of_People;
+ Creator_ID = trip.Creator_ID;
+ Start_date = datesRange.Start_date;
+ End_date = datesRange.End_date;
+ Destination_ID = trip.Destination_ID;
+ Is_Abroad = destination.Is_Abroad;
+ Country = destination.Country;
+ City = destination.City;
}
public int Trip_ID { get; set; }
- [StringLength(30, MinimumLength = 3, ErrorMessage = "Назва подорожі має містити принаймні 3 символи.")]
- [DisplayName("Назва")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [StringLength(30, MinimumLength = 3, ErrorMessage = "Trip title must have at least 3 chars.")]
+ [DisplayName("Trip title")]
+ [Required(ErrorMessage = "This field is required.")]
public string Trip_Title { get; set; }
- [StringLength(30, MinimumLength = 3, ErrorMessage = "Опис подорожі має містити принаймні 3 символи.")]
- [DisplayName("Опис")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [StringLength(30, MinimumLength = 3, ErrorMessage = "Description must have at least 3 chars.")]
+ [DisplayName("Description")]
+ [Required(ErrorMessage = "This field is required.")]
public string Description { get; set; }
-
- [DisplayName("Вартість")]
+
public double Price { get; set; }
-
+
public int Date_ID { get; set; }
- [DisplayName("Початкова дата")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [DisplayName("Start date")]
+ [Required(ErrorMessage = "This field is required.")]
[DataType(DataType.Date)]
public Nullable Start_date { get; set; }
- [DisplayName("Кінцева дата")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [DisplayName("End date")]
+ [Required(ErrorMessage = "This field is required.")]
[DataType(DataType.Date)]
public Nullable End_date { get; set; }
- [DisplayName("Кількість людей")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [DisplayName("Number of people")]
+ [Required(ErrorMessage = "This field is required.")]
public int Number_Of_People { get; set; }
[DisplayName("Destination ID")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [Required(ErrorMessage = "This field is required.")]
public int Destination_ID { get; set; }
- [DisplayName("Це закордоном?")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [DisplayName("Is it Abroad ?")]
+ [Required(ErrorMessage = "This field is required.")]
public bool Is_Abroad { get; set; }
-
- [DisplayName("Країна")]
public string Country { get; set; }
-
- [DisplayName("Місто")]
public string City { get; set; }
-
public int Creator_ID { get; set; }
+
+
+
}
}
diff --git a/uthTripProject/Models/UserBlockedModel.cs b/uthTripProject/Models/UserBlockedModel.cs
deleted file mode 100644
index ff685eb..0000000
--- a/uthTripProject/Models/UserBlockedModel.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-namespace UthTripProject.Models
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
-
- public class UserBlockedModel
- {
- public UserBlockedModel()
- {
-
- }
-
- public UserBlockedModel(int user_ID, string first_Name, string last_Name, string email, string username, string password, DateTime birthday, string photo_Url, string info, bool isBlocked)
- {
- User_ID = user_ID;
- First_Name = first_Name;
- Last_Name = last_Name;
- Email = email;
- Username = username;
- Password = password;
- Birthday = birthday;
- Photo_Url = photo_Url;
- Info = info;
- this.isBlocked = isBlocked;
- }
-
- public int User_ID { get; set; }
-
- public string First_Name { get; set; }
-
- public string Last_Name { get; set; }
-
- public string Email { get; set; }
-
- public string Username { get; set; }
-
- public string Password { get; set; }
-
- public System.DateTime Birthday { get; set; }
-
- public string Photo_Url { get; set; }
-
- public string Info { get; set; }
-
- public bool isBlocked { get; set; }
- }
-}
diff --git a/uthTripProject/Models/UserViewModel.cs b/uthTripProject/Models/UserViewModel.cs
index f303258..cd70baa 100644
--- a/uthTripProject/Models/UserViewModel.cs
+++ b/uthTripProject/Models/UserViewModel.cs
@@ -1,34 +1,34 @@
-namespace UthTripProject.Models
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace uthTripProject.Models
+{
public class UserViewModel
{
public int User_ID { get; set; }
- [StringLength(30, MinimumLength = 4, ErrorMessage = "Ім'я має містити принаймні 4 символи.")]
- [DisplayName("Ім'я")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [StringLength(30, MinimumLength = 4, ErrorMessage = "First name must have at least 4 chars.")]
+ [DisplayName("First name")]
+ [Required(ErrorMessage = "This field is required.")]
public string First_Name { get; set; }
- [StringLength(30, MinimumLength = 3, ErrorMessage = "Прізвище має містити принаймні 3 символи.")]
- [DisplayName("Прізвище")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [StringLength(30, MinimumLength = 3, ErrorMessage = "Last name must have at least 3 chars.")]
+ [DisplayName("Last name")]
+ [Required(ErrorMessage = "This field is required.")]
public string Last_Name { get; set; }
[DataType(DataType.EmailAddress)]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [Required(ErrorMessage = "This field is required.")]
public string Email { get; set; }
- [StringLength(30, MinimumLength = 4, ErrorMessage = "Ім'я коростувача має містити принаймні 4 символи.")]
- [Required(ErrorMessage = "Обов'язкове поле.")]
+ [StringLength(30, MinimumLength = 4, ErrorMessage = "User name must have at least 4 chars.")]
+ [Required(ErrorMessage = "This field is required.")]
public string Username { get; set; }
- [StringLength(30, MinimumLength = 5, ErrorMessage = "Пароль має містити принаймні 4 символи.")]
+ [StringLength(30, MinimumLength = 5, ErrorMessage = "Password must have at least 5 char.")]
[DataType(DataType.Password)]
public string Password { get; set; }
@@ -37,20 +37,22 @@ public class UserViewModel
[Compare("Password")]
public string ConfirmPassword { get; set; }
- [DisplayName("Дата народження")]
+ [DisplayName("Birthday date")]
[DataType(DataType.Date)]
- ////[Required(ErrorMessage = "This field is required.")]
+ //[Required(ErrorMessage = "This field is required.")]
public System.DateTime Birthday { get; set; }
- ////[StringLength(30, MinimumLength = 5, ErrorMessage = "Photo URL must have at least 5 char.")]
- [DisplayName("URL фото")]
- ////[Required(ErrorMessage = "This field is required.")]
+
+ //[StringLength(30, MinimumLength = 5, ErrorMessage = "Photo URL must have at least 5 char.")]
+ [DisplayName("Your photo URL")]
+ //[Required(ErrorMessage = "This field is required.")]
public string Photo_Url { get; set; }
- ////[StringLength(30, MinimumLength = 10, ErrorMessage = "Info must have at least 3 char.")]
- [DisplayName("Трохи інформації про тебе")]
+ //[StringLength(30, MinimumLength = 10, ErrorMessage = "Info must have at least 3 char.")]
+ [DisplayName("Some information about you")]
[DataType(DataType.MultilineText)]
- ////[Required(ErrorMessage = "This field is required.")]
+ //[Required(ErrorMessage = "This field is required.")]
public string Info { get; set; }
}
+
}
diff --git a/uthTripProject/Properties/AssemblyInfo.cs b/uthTripProject/Properties/AssemblyInfo.cs
index eef0794..4dfd73c 100644
--- a/uthTripProject/Properties/AssemblyInfo.cs
+++ b/uthTripProject/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@
// 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("UthTripProject")]
+[assembly: AssemblyTitle("uthTripProject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UthTripProject")]
+[assembly: AssemblyProduct("uthTripProject")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/uthTripProject/Startup.cs b/uthTripProject/Startup.cs
index 9106c5f..8440e0b 100644
--- a/uthTripProject/Startup.cs
+++ b/uthTripProject/Startup.cs
@@ -1,15 +1,14 @@
using Microsoft.Owin;
using Owin;
-[assembly: OwinStartupAttribute(typeof(UthTripProject.Startup))]
-
-namespace UthTripProject
+[assembly: OwinStartupAttribute(typeof(uthTripProject.Startup))]
+namespace uthTripProject
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
- this.ConfigureAuth(app);
+ ConfigureAuth(app);
}
}
}
diff --git a/uthTripProject/UnitTest/Test.cs b/uthTripProject/UnitTest/Test.cs
index e69de29..f983e55 100644
--- a/uthTripProject/UnitTest/Test.cs
+++ b/uthTripProject/UnitTest/Test.cs
@@ -0,0 +1,161 @@
+using System.Collections.Generic;
+using System.Linq;
+using System;
+using Moq;
+using uthTripProject.Controllers;
+using uthTripProject.Models;
+using uthTrip.BLL.Services;
+using uthTrip.BLL.Interfaces;
+using uthTrip.BLL.DTO;
+using System.Web.Mvc;
+using Xunit;
+
+namespace uthTripProject.Tests
+{
+ public class HomeControllerTests
+ {
+ DateTime somedate = new DateTime(2000, 07, 21);
+
+ [Fact]
+ public void Index_View_Result()
+ {
+ // Setup
+ var expectedUserAccountCount = 2;
+
+ var mockUserAccountService = new Mock();
+
+ mockUserAccountService.Setup(x => x.GetAll())
+ .Returns(GetTestUserAccounts());
+
+ // Inject
+ var homeController = new UserController(mockUserAccountService.Object);
+
+ // Act
+ var result = homeController.Index();
+
+ // Assert
+ var viewResult = Assert.IsType(result);
+
+ var model = Assert.IsAssignableFrom>(
+ viewResult.ViewData.Model);
+
+ Assert.Equal(expectedUserAccountCount, model.Count());
+ }
+
+ [Fact]
+ public void Account_View_Result_One()
+ {
+ // Setup
+ var expectedUserAccountId = 123;
+
+ var mockUserAccountService = new Mock();
+
+ mockUserAccountService.Setup(x => x.Get(expectedUserAccountId))
+ .Returns(GetTestUserAccountOne());
+
+ // Inject
+ var homeController = new UserController(mockUserAccountService.Object);
+
+ // Act
+ var result = homeController.Account(expectedUserAccountId);
+
+ // Assert
+ var viewResult = Assert.IsType(result);
+
+ var viewModel = Assert.IsAssignableFrom