Skip to content

Commit

Permalink
UserService eklendi.
Browse files Browse the repository at this point in the history
  • Loading branch information
cemdenizsel committed Dec 20, 2020
1 parent f5f0d2c commit 574a7e0
Show file tree
Hide file tree
Showing 24 changed files with 1,386 additions and 374 deletions.
997 changes: 997 additions & 0 deletions .vs/CS434.API/config/applicationhost.config

Large diffs are not rendered by default.

Binary file modified .vs/CS434.API/v16/.suo
Binary file not shown.
Binary file modified .vs/LibraryApplication/v16/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
Binary file modified .vs/slnx.sqlite
Binary file not shown.
7 changes: 7 additions & 0 deletions CS434.API/CS434.API.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup>
</Project>
33 changes: 33 additions & 0 deletions CS434.API/Controllers/UsersController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CS434.API.Interfaces;
using CS434.API.MODELS.Request;
using CS434.API.MODELS.Response;
using CS434.API.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;

namespace CS434.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class UsersController : ControllerBase
{
IUserService userService;
IConfiguration configuration;
public UsersController(IConfiguration configuration)
{
userService = new UserService(configuration);
}

[HttpPost("SignIn")]
public MessageModel SignIn(SignInRequestModel signInRequestModel)
{
return userService.SignIn(signInRequestModel);
}

}
}
45 changes: 0 additions & 45 deletions CS434.API/Controllers/ValuesController.cs

This file was deleted.

2 changes: 1 addition & 1 deletion CS434.API/Interfaces/IUserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ namespace CS434.API.Interfaces
interface IUserService
{
Task<MessageModel> SignUp(SignUpRequestModel signUpRequestModel);
SignInResponseModel SignIn(SignInRequestModel signInRequestModel);
MessageModel SignIn(SignInRequestModel signInRequestModel);
}
}
2 changes: 2 additions & 0 deletions CS434.API/MODELS/Response/MessageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ namespace CS434.API.MODELS.Response
{
public class MessageModel
{
public bool Result { get; set; }
public string Message { get; set; }
}
}
12 changes: 0 additions & 12 deletions CS434.API/MODELS/Response/SignInResponseModel.cs

This file was deleted.

11 changes: 0 additions & 11 deletions CS434.API/MODELS/Response/SignUpResponseModel.cs

This file was deleted.

33 changes: 31 additions & 2 deletions CS434.API/Services/UserService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CS434.API.Interfaces;
using CS434.API.MODELS.Database;
using CS434.API.MODELS.Request;
using CS434.API.MODELS.Response;
using Microsoft.Extensions.Configuration;
Expand All @@ -17,9 +18,37 @@ public UserService(IConfiguration configuration)
this.configuration = configuration;
}

public SignInResponseModel SignIn(SignInRequestModel signInRequestModel)
public MessageModel SignIn(SignInRequestModel signInRequestModel)
{
throw new NotImplementedException();
using (var dbContext = new DEV_Context())
{
try
{
MessageModel messageModel = new MessageModel();
var user = dbContext.Set<Users>().FirstOrDefault(x => x.EMAIL == signInRequestModel.Email);
if (user == null)
{
messageModel.Result = false;
messageModel.Message = "Kullanıcı Bulunamamaktadır!";
return messageModel;
}
else if (user.PASSWORD != signInRequestModel.Password)
{
messageModel.Result = false;
messageModel.Message = "Kullanıcı bilgileriniz hatalı!";
return messageModel;
}

messageModel.Result = true;
messageModel.Message = "Başarıyla girilmiştir!";
return messageModel;
}
catch (Exception e)
{

throw e;
}
}
}

public Task<MessageModel> SignUp(SignUpRequestModel signUpRequestModel)
Expand Down
4 changes: 4 additions & 0 deletions CS434.API/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()));
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand All @@ -41,6 +44,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
}

app.UseHttpsRedirection();
app.UseCors("AllowAll");
app.UseMvc();
}
}
Expand Down
16 changes: 8 additions & 8 deletions CS434.API/obj/CS434.API.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"format": 1,
"restore": {
"C:\\Users\\LENOVO\\Source\\Repos\\LibraryApplication\\CS434.API\\CS434.API.csproj": {}
"C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj": {}
},
"projects": {
"C:\\Users\\LENOVO\\Source\\Repos\\LibraryApplication\\CS434.API\\CS434.API.csproj": {
"C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\LENOVO\\Source\\Repos\\LibraryApplication\\CS434.API\\CS434.API.csproj",
"projectUniqueName": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj",
"projectName": "CS434.API",
"projectPath": "C:\\Users\\LENOVO\\Source\\Repos\\LibraryApplication\\CS434.API\\CS434.API.csproj",
"packagesPath": "C:\\Users\\LENOVO\\.nuget\\packages\\",
"outputPath": "C:\\Users\\LENOVO\\Source\\Repos\\LibraryApplication\\CS434.API\\obj\\",
"projectPath": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj",
"packagesPath": "C:\\Users\\Cem\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\LENOVO\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Users\\Cem\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
Expand Down Expand Up @@ -66,7 +66,7 @@
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.301\\RuntimeIdentifierGraph.json"
}
}
}
Expand Down
13 changes: 5 additions & 8 deletions CS434.API/obj/CS434.API.csproj.nuget.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\LENOVO\.nuget\packages\</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Cem\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.7.0</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.6.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="$([MSBuild]::EnsureTrailingSlash($(NuGetPackageFolders)))" />
</ItemGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
Expand All @@ -25,8 +22,8 @@
<Import Project="$(NuGetPackageRoot)microsoft.aspnetcore.app\2.1.1\build\netcoreapp2.1\Microsoft.AspNetCore.App.props" Condition="Exists('$(NuGetPackageRoot)microsoft.aspnetcore.app\2.1.1\build\netcoreapp2.1\Microsoft.AspNetCore.App.props')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgMicrosoft_EntityFrameworkCore_Tools Condition=" '$(PkgMicrosoft_EntityFrameworkCore_Tools)' == '' ">C:\Users\LENOVO\.nuget\packages\microsoft.entityframeworkcore.tools\2.1.1</PkgMicrosoft_EntityFrameworkCore_Tools>
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\LENOVO\.nuget\packages\microsoft.codeanalysis.analyzers\1.1.0</PkgMicrosoft_CodeAnalysis_Analyzers>
<PkgMicrosoft_AspNetCore_Razor_Design Condition=" '$(PkgMicrosoft_AspNetCore_Razor_Design)' == '' ">C:\Users\LENOVO\.nuget\packages\microsoft.aspnetcore.razor.design\2.1.2</PkgMicrosoft_AspNetCore_Razor_Design>
<PkgMicrosoft_EntityFrameworkCore_Tools Condition=" '$(PkgMicrosoft_EntityFrameworkCore_Tools)' == '' ">C:\Users\Cem\.nuget\packages\microsoft.entityframeworkcore.tools\2.1.1</PkgMicrosoft_EntityFrameworkCore_Tools>
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\Cem\.nuget\packages\microsoft.codeanalysis.analyzers\1.1.0</PkgMicrosoft_CodeAnalysis_Analyzers>
<PkgMicrosoft_AspNetCore_Razor_Design Condition=" '$(PkgMicrosoft_AspNetCore_Razor_Design)' == '' ">C:\Users\Cem\.nuget\packages\microsoft.aspnetcore.razor.design\2.1.2</PkgMicrosoft_AspNetCore_Razor_Design>
</PropertyGroup>
</Project>
Binary file modified CS434.API/obj/Debug/netcoreapp2.1/CS434.API.assets.cache
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e766761fd72d2d89c2c2926d4b4967f599b243f7
50c0696addc925e66c89e07b4d3e8a847781c623
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ C:\Users\Cem\source\repos\CS434.API\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.
C:\Users\Cem\source\repos\CS434.API\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.dll
C:\Users\Cem\source\repos\CS434.API\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.pdb
C:\Users\Cem\source\repos\CS434.API\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.genruntimeconfig.cache
C:\Users\Cem\Source\Repos\ozanozbirecikli\LibraryApplication\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.csprojAssemblyReference.cache
C:\Users\Cem\Source\Repos\ozanozbirecikli\LibraryApplication\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.AssemblyInfoInputs.cache
C:\Users\Cem\Source\Repos\ozanozbirecikli\LibraryApplication\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.AssemblyInfo.cs
C:\Users\Cem\Source\Repos\ozanozbirecikli\LibraryApplication\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.csproj.CoreCompileInputs.cache
C:\Users\Cem\Source\Repos\ozanozbirecikli\LibraryApplication\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.RazorAssemblyInfo.cache
C:\Users\Cem\Source\Repos\ozanozbirecikli\LibraryApplication\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.RazorAssemblyInfo.cs
C:\Users\Cem\Source\Repos\ozanozbirecikli\LibraryApplication\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.dll
C:\Users\Cem\Source\Repos\ozanozbirecikli\LibraryApplication\CS434.API\obj\Debug\netcoreapp2.1\CS434.API.pdb
Binary file not shown.
Binary file modified CS434.API/obj/Release/netcoreapp2.1/CS434.API.assets.cache
Binary file not shown.
Binary file not shown.
14 changes: 7 additions & 7 deletions CS434.API/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -11880,19 +11880,19 @@
]
},
"packageFolders": {
"C:\\Users\\LENOVO\\.nuget\\packages\\": {}
"C:\\Users\\Cem\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\LENOVO\\Source\\Repos\\LibraryApplication\\CS434.API\\CS434.API.csproj",
"projectUniqueName": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj",
"projectName": "CS434.API",
"projectPath": "C:\\Users\\LENOVO\\Source\\Repos\\LibraryApplication\\CS434.API\\CS434.API.csproj",
"packagesPath": "C:\\Users\\LENOVO\\.nuget\\packages\\",
"outputPath": "C:\\Users\\LENOVO\\Source\\Repos\\LibraryApplication\\CS434.API\\obj\\",
"projectPath": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\CS434.API.csproj",
"packagesPath": "C:\\Users\\Cem\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Cem\\Source\\Repos\\ozanozbirecikli\\LibraryApplication\\CS434.API\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\LENOVO\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Users\\Cem\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
Expand Down Expand Up @@ -11944,7 +11944,7 @@
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.301\\RuntimeIdentifierGraph.json"
}
}
}
Expand Down
Loading

0 comments on commit 574a7e0

Please sign in to comment.