├── AngularUI ├── ReCapAngularUI │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── components │ │ │ │ ├── car │ │ │ │ │ ├── car.component.css │ │ │ │ │ ├── car.component.html │ │ │ │ │ ├── car.component.spec.ts │ │ │ │ │ └── car.component.ts │ │ │ │ ├── navi │ │ │ │ │ ├── navi.component.css │ │ │ │ │ ├── navi.component.ts │ │ │ │ │ ├── navi.component.spec.ts │ │ │ │ │ └── navi.component.html │ │ │ │ ├── brand │ │ │ │ │ ├── brand.component.css │ │ │ │ │ ├── brand.component.html │ │ │ │ │ ├── brand.component.spec.ts │ │ │ │ │ └── brand.component.ts │ │ │ │ ├── color │ │ │ │ │ ├── color.component.css │ │ │ │ │ ├── color.component.html │ │ │ │ │ ├── color.component.spec.ts │ │ │ │ │ └── color.component.ts │ │ │ │ ├── rental │ │ │ │ │ ├── rental.component.css │ │ │ │ │ ├── rental.component.spec.ts │ │ │ │ │ ├── rental.component.html │ │ │ │ │ └── rental.component.ts │ │ │ │ └── customer │ │ │ │ │ ├── customer.component.css │ │ │ │ │ ├── customer.component.html │ │ │ │ │ ├── customer.component.spec.ts │ │ │ │ │ └── customer.component.ts │ │ │ ├── models │ │ │ │ ├── color.ts │ │ │ │ ├── brand.ts │ │ │ │ ├── responseModel.ts │ │ │ │ ├── customer.ts │ │ │ │ ├── rental.ts │ │ │ │ ├── listResponseModel.ts │ │ │ │ └── carDto.ts │ │ │ ├── app.component.html │ │ │ ├── app.component.ts │ │ │ ├── services │ │ │ │ ├── brand.service.ts │ │ │ │ ├── color.service.ts │ │ │ │ ├── car.service.ts │ │ │ │ ├── rental.service.ts │ │ │ │ └── customer.service.ts │ │ │ ├── app-routing.module.ts │ │ │ ├── app.module.ts │ │ │ └── app.component.spec.ts │ │ ├── styles.css │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── test.ts │ │ └── polyfills.ts │ ├── e2e │ │ ├── src │ │ │ ├── app.po.ts │ │ │ └── app.e2e-spec.ts │ │ ├── tsconfig.json │ │ └── protractor.conf.js │ ├── .editorconfig │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ ├── .browserslistrc │ ├── .gitignore │ ├── tsconfig.json │ ├── README.md │ ├── package.json │ ├── karma.conf.js │ ├── tslint.json │ └── angular.json ├── package.json └── package-lock.json ├── README.md ├── Core ├── Entities │ ├── IDto.cs │ ├── IEntity.cs │ └── Concrete │ │ ├── OperationClaim.cs │ │ ├── UserOperationClaim.cs │ │ └── User.cs ├── Utilities │ ├── Results │ │ ├── IDataResult.cs │ │ ├── IResult.cs │ │ ├── ErrorResult.cs │ │ ├── SuccessResult.cs │ │ ├── Result.cs │ │ ├── ErrorDataResult.cs │ │ ├── DataResult.cs │ │ └── SuccessDataResult.cs │ ├── IoC │ │ ├── ICoreModule.cs │ │ └── ServiceTool.cs │ ├── Security │ │ ├── Jwt │ │ │ ├── AccessToken.cs │ │ │ ├── ITokenHelper.cs │ │ │ ├── TokenOptions.cs │ │ │ └── JwtHelper.cs │ │ ├── Encryption │ │ │ ├── SecurityKeyHelper.cs │ │ │ └── SigningCredentialsHelper.cs │ │ └── Hashing │ │ │ └── HashingHelper.cs │ ├── Business │ │ └── BusinessRules.cs │ ├── Interceptors │ │ ├── MethodInterceptionBaseAttribute.cs │ │ ├── AspectInterceptorSelector.cs │ │ └── MethodInterception.cs │ └── Extensions │ │ ├── ServiceCollectionExtensions.cs │ │ ├── ClaimsPrincipalExtensions.cs │ │ └── ClaimExtensions.cs ├── CrossCuttingConserns │ ├── Caching │ │ ├── ICacheManager.cs │ │ └── Microsoft │ │ │ └── MemoryCacheManager.cs │ └── Validation │ │ └── ValidationTool.cs ├── DataAccess │ ├── IEntityRepository.cs │ └── EntityFramework │ │ └── EfEntityRepositoryBase.cs ├── DependencyResolvers │ └── CoreModule.cs ├── Aspects │ └── Autofac │ │ ├── Transaction │ │ └── TransactionScopeAspect.cs │ │ ├── Caching │ │ ├── CacheRemoveAspect.cs │ │ └── CacheAspect.cs │ │ ├── Performance │ │ └── PerformanceAspect.cs │ │ └── Validation │ │ └── ValidationAspect.cs └── Core.csproj ├── WebAPI ├── appsettings.Development.json ├── appsettings.json ├── WebAPI.csproj ├── Properties │ └── launchSettings.json ├── Program.cs ├── Utilities │ └── ImageUploader.cs ├── Controllers │ ├── AuthController.cs │ ├── ColorsController.cs │ ├── UsersController.cs │ ├── BrandsController.cs │ ├── CustomersController.cs │ ├── RentalsController.cs │ ├── CarsController.cs │ └── CarImagesController.cs └── Startup.cs ├── DataAccess ├── Abstract │ ├── IBrandDal.cs │ ├── IColorDal.cs │ ├── IRentalDal.cs │ ├── ICarImageDal.cs │ ├── ICustomerDal.cs │ ├── IUserDal.cs │ └── ICarDal.cs ├── Concrete │ ├── EntityFramework │ │ ├── EfBrandDal.cs │ │ ├── EfColorDal.cs │ │ ├── EfRentalDal.cs │ │ ├── EfCarImageDal.cs │ │ ├── EfCustomerDal.cs │ │ ├── Mapping │ │ │ ├── CustomerMap.cs │ │ │ ├── BrandMap.cs │ │ │ ├── ColorMap.cs │ │ │ ├── UserMap.cs │ │ │ ├── RentalMap.cs │ │ │ ├── CarImageMap.cs │ │ │ └── CarMap.cs │ │ ├── EfUserDal.cs │ │ ├── Context │ │ │ └── ReCapContext.cs │ │ └── EfCarDal.cs │ └── InMemory │ │ ├── MemColorDal.cs │ │ ├── MemBrandDal.cs │ │ └── MemCarDal.cs └── DataAccess.csproj ├── Entities ├── Dtos │ ├── UserForLoginDto.cs │ ├── UserForRegisterDto.cs │ └── CarDto.cs ├── Entities.csproj └── Concrete │ ├── Customer.cs │ ├── CarImage.cs │ ├── Rental.cs │ ├── Color.cs │ ├── Brand.cs │ └── Car.cs ├── Business ├── DependencySolvers │ ├── InstanceFactory.cs │ ├── BusinessModule.cs │ └── Autofac │ │ └── AutofacBusinessModule.cs ├── ValidationRules │ └── FluentValidation │ │ ├── CarValidator.cs │ │ └── BrandValidator.cs ├── Abstract │ ├── IBrandService.cs │ ├── IColorService.cs │ ├── IAuthService.cs │ ├── ICustomerService.cs │ ├── IRentalService.cs │ ├── ICarImageService.cs │ ├── IUserService.cs │ └── ICarService.cs ├── Business.csproj ├── Constants │ └── Messages.cs └── Concrete │ ├── ColorManager.cs │ ├── CustomerManager.cs │ ├── BrandManager.cs │ ├── UserManager.cs │ ├── RentalManager.cs │ ├── CarImageManager.cs │ ├── CarManager.cs │ └── AuthManager.cs ├── ConsoleUI ├── ConsoleUI.csproj └── Program.cs ├── .gitattributes ├── ReCapProject.sln └── .gitignore /AngularUI/ReCapAngularUI/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/car/car.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/color/color.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/rental/rental.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AngularUI/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "jquery": "^3.6.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReCapProject 2 | First Upload 3 | Dependency Injection Ninject kullanıldı. 4 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/models/color.ts: -------------------------------------------------------------------------------- 1 | export interface Color{ 2 | id:number; 3 | name:string; 4 | } -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/models/brand.ts: -------------------------------------------------------------------------------- 1 | export interface Brand{ 2 | id:number; 3 | name:string; 4 | cars:any; 5 | } -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idogus/ReCapProject/HEAD/AngularUI/ReCapAngularUI/src/favicon.ico -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/models/responseModel.ts: -------------------------------------------------------------------------------- 1 | export interface ResponseModel{ 2 | success:boolean; 3 | message:string; 4 | } -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/models/customer.ts: -------------------------------------------------------------------------------- 1 | export interface Customer{ 2 | id:number; 3 | userId:number; 4 | companyName:string; 5 | } -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/models/rental.ts: -------------------------------------------------------------------------------- 1 | export interface Rental{ 2 | id:number; 3 | carId:number; 4 | customerId:number; 5 | rentDate:Date; 6 | returnDate:Date; 7 | } -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/models/listResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface ListResponseModel extends ResponseModel{ 4 | data:T[]; 5 | } -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/models/carDto.ts: -------------------------------------------------------------------------------- 1 | export interface CarDto{ 2 | brand:string; 3 | color:string; 4 | modelYear:number; 5 | dailyPrice:number; 6 | description:string; 7 | } -------------------------------------------------------------------------------- /Core/Entities/IDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entity 6 | { 7 | public interface IDto 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Core/Entities/IEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entity 6 | { 7 | public interface IEntity 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /WebAPI/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | 6 |
7 |
8 |
9 | -------------------------------------------------------------------------------- /Core/Utilities/Results/IDataResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public interface IDataResult: IResult 8 | { 9 | T Data { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Core/Utilities/Results/IResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public interface IResult 8 | { 9 | bool Success { get; } 10 | string Message { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'ReCapAngularUI'; 10 | } 11 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IBrandDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace DataAccess.Abstract 8 | { 9 | public interface IBrandDal : IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IColorDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace DataAccess.Abstract 8 | { 9 | public interface IColorDal : IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IRentalDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace DataAccess.Abstract 8 | { 9 | public interface IRentalDal : IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICarImageDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace DataAccess.Abstract 8 | { 9 | public interface ICarImageDal : IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICustomerDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace DataAccess.Abstract 8 | { 9 | public interface ICustomerDal : IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Core/Utilities/IoC/ICoreModule.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.IoC 7 | { 8 | public interface ICoreModule 9 | { 10 | void Load(IServiceCollection services); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Jwt/AccessToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Security.Jwt 6 | { 7 | public class AccessToken 8 | { 9 | public string Token { get; set; } 10 | public DateTime Expiration { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Entities/Dtos/UserForLoginDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Dtos 7 | { 8 | public class UserForLoginDto : IDto 9 | { 10 | public string EMail { get; set; } 11 | public string Password { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/OperationClaim.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Entities.Concrete 7 | { 8 | public class OperationClaim : IEntity 9 | { 10 | public int Id { get; set; } 11 | public string Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Jwt/ITokenHelper.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Security.Jwt 7 | { 8 | public interface ITokenHelper 9 | { 10 | AccessToken CreateToken(User user, List operationClaims); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/Utilities/Results/ErrorResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class ErrorResult : Result, IResult 8 | { 9 | public ErrorResult() : base(false) { } 10 | 11 | public ErrorResult(string message) : base(false, message) { } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Entities/Entities.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /Core/Utilities/Results/SuccessResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class SuccessResult : Result, IResult 8 | { 9 | public SuccessResult() : base(true) { } 10 | 11 | public SuccessResult(string message) : base(true, message) { } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Entities/Concrete/Customer.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class Customer : IEntity 9 | { 10 | public int Id { get; set; } 11 | public int UserId { get; set; } 12 | public string CompanyName { get; set; } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ReCapAngularUI 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/navi/navi.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-navi', 5 | templateUrl: './navi.component.html', 6 | styleUrls: ['./navi.component.css'] 7 | }) 8 | export class NaviComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.Abstract; 2 | using Core.Entities.Concrete; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Abstract 9 | { 10 | public interface IUserDal : IEntityRepository 11 | { 12 | List GetClaims(User user); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/UserOperationClaim.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Entities.Concrete 7 | { 8 | public class UserOperationClaim : IEntity 9 | { 10 | public int Id { get; set; } 11 | public int UserId { get; set; } 12 | public int OperationClaimId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICarDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using Entities.Dtos; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Abstract 9 | { 10 | public interface ICarDal : IEntityRepository 11 | { 12 | List GetCarsDetails(); 13 | CarDTO GetCarDetailsById(int id); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Jwt/TokenOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Security.Jwt 6 | { 7 | public class TokenOptions 8 | { 9 | public string Audience { get; set; } 10 | public string Issuer { get; set; } 11 | public int AccessTokenExpiration { get; set; } 12 | public string SecurityKey { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Business/DependencySolvers/InstanceFactory.cs: -------------------------------------------------------------------------------- 1 | using Ninject; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Business.DependencySolvers 7 | { 8 | public class InstanceFactory 9 | { 10 | public static T GetInstance() 11 | { 12 | var kernel = new StandardKernel(new BusinessModule()); 13 | return kernel.Get(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Entities/Dtos/UserForRegisterDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Dtos 7 | { 8 | public class UserForRegisterDto : IDto 9 | { 10 | public string EMail { get; set; } 11 | public string Password { get; set; } 12 | public string FirstName { get; set; } 13 | public string LastName { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfBrandDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using DataAccess.Concrete.EntityFramework.Context; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.EntityFramework 10 | { 11 | public class EfBrandDal : EfEntityRepositoryBase, IBrandDal 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfColorDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using DataAccess.Concrete.EntityFramework.Context; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.EntityFramework 10 | { 11 | public class EfColorDal : EfEntityRepositoryBase, IColorDal 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /WebAPI/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "TokenOptions": { 3 | "Audience": "www.ibrahim-dogus.com.tr", 4 | "Issuer": "www.ibrahim-dogus.com.tr", 5 | "AccessTokenExpiration": 10, 6 | "SecurityKey": "mysecretkeymysecretkey" 7 | }, 8 | "Logging": { 9 | "LogLevel": { 10 | "Default": "Information", 11 | "Microsoft": "Warning", 12 | "Microsoft.Hosting.Lifetime": "Information" 13 | } 14 | }, 15 | "AllowedHosts": "*" 16 | } 17 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/CarValidator.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using FluentValidation; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Business.ValidationRules.FluentValidation 8 | { 9 | public class CarValidator : AbstractValidator 10 | { 11 | public CarValidator() 12 | { 13 | RuleFor(x => x.DailyPrice).GreaterThan(0); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfRentalDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using DataAccess.Concrete.EntityFramework.Context; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.EntityFramework 10 | { 11 | public class EfRentalDal : EfEntityRepositoryBase, IRentalDal 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/BrandValidator.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using FluentValidation; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Business.ValidationRules.FluentValidation 8 | { 9 | public class BrandValidator : AbstractValidator 10 | { 11 | public BrandValidator() 12 | { 13 | RuleFor(x => x.Name).MinimumLength(2); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Entities/Dtos/CarDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Dtos 7 | { 8 | public class CarDTO : IDto 9 | { 10 | public string Brand { get; set; } 11 | public string Color { get; set; } 12 | public int ModelYear { get; set; } 13 | public decimal DailyPrice { get; set; } 14 | public string Description { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCarImageDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using DataAccess.Concrete.EntityFramework.Context; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.EntityFramework 10 | { 11 | public class EfCarImageDal : EfEntityRepositoryBase, ICarImageDal 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCustomerDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using DataAccess.Concrete.EntityFramework.Context; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.EntityFramework 10 | { 11 | public class EfCustomerDal : EfEntityRepositoryBase, ICustomerDal 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Entities/Concrete/CarImage.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class CarImage : IEntity 9 | { 10 | public int Id { get; set; } 11 | public int CarId { get; set; } 12 | public string ImagePath { get; set; } 13 | public DateTime Date { get; set; } 14 | 15 | public virtual Car Car { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Entities/Concrete/Rental.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class Rental : IEntity 9 | { 10 | public int Id { get; set; } 11 | public int CarId { get; set; } 12 | public int CustomerId { get; set; } 13 | public DateTime RentDate { get; set; } 14 | public DateTime? ReturnDate { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Entities/Concrete/Color.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class Color : IEntity 9 | { 10 | public int Id { get; set; } 11 | public string Name { get; set; } 12 | 13 | public ICollection Cars { get; set; } 14 | public override string ToString() 15 | { 16 | return Name; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Encryption/SecurityKeyHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.IdentityModel.Tokens; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Security.Encryption 7 | { 8 | public class SecurityKeyHelper 9 | { 10 | public static SecurityKey CreateSecurityKey(string securityKey) 11 | { 12 | return new SymmetricSecurityKey(Encoding.UTF8.GetBytes(securityKey)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Entities/Concrete/Brand.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class Brand : IEntity 9 | { 10 | public int Id { get; set; } 11 | public string Name { get; set; } 12 | 13 | public ICollection Cars { get; set; } 14 | 15 | public override string ToString() 16 | { 17 | return Name; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Core/CrossCuttingConserns/Caching/ICacheManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.CrossCuttingConserns.Caching 6 | { 7 | public interface ICacheManager 8 | { 9 | T Get(string key); 10 | object Get(string key); 11 | void Add(string key, object value, int duration); 12 | bool IsAdd(string key); 13 | void Remove(string key); 14 | void RemovePattern(string pattern); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
#Marka Adı
{{brand.id}}{{brand.name}}
18 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Encryption/SigningCredentialsHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.IdentityModel.Tokens; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Security.Encryption 7 | { 8 | public class SigningCredentialsHelper 9 | { 10 | public static SigningCredentials CreateSigningCredentials(SecurityKey securityKey) 11 | { 12 | return new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha512Signature); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Core/Utilities/Business/BusinessRules.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Business 7 | { 8 | public class BusinessRules 9 | { 10 | public static IResult Run(params IResult[] logics) 11 | { 12 | foreach (var logic in logics) 13 | { 14 | if (!logic.Success) 15 | return logic; 16 | } 17 | return null; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Core/Utilities/Results/Result.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class Result : IResult 8 | { 9 | public Result(bool success) 10 | { 11 | Success = success; 12 | } 13 | public Result(bool success, string message) : this(success) 14 | { 15 | Message = message; 16 | } 17 | public bool Success { get; } 18 | 19 | public string Message { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/MethodInterceptionBaseAttribute.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Interceptors 7 | { 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] 9 | public class MethodInterceptionBaseAttribute : Attribute, IInterceptor 10 | { 11 | public int Priority { get; set; } 12 | public virtual void Intercept(IInvocation invocation) { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Core/Utilities/Results/ErrorDataResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class ErrorDataResult : DataResult 8 | { 9 | public ErrorDataResult() : base(default, false) { } 10 | public ErrorDataResult(string message) : base(default, false, message) { } 11 | public ErrorDataResult(T data) : base(data, false) { } 12 | public ErrorDataResult(T data, string message) : base(data, false, message) { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Core/Utilities/Results/DataResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class DataResult : Result, IDataResult 8 | { 9 | public DataResult(T data, bool success) : base(success) 10 | { 11 | Data = data; 12 | } 13 | public DataResult(T data, bool success, string message) : base(success, message) 14 | { 15 | Data = data; 16 | } 17 | public T Data { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Core/Utilities/Results/SuccessDataResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class SuccessDataResult : DataResult 8 | { 9 | public SuccessDataResult() : base(default, true) { } 10 | public SuccessDataResult(string message) : base(default, true, message) { } 11 | public SuccessDataResult(T data) : base(data, true) { } 12 | public SuccessDataResult(T data, string message) : base(data, true, message) { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
#Renk
{{color.id}}{{color.name}}
18 | -------------------------------------------------------------------------------- /Core/Utilities/IoC/ServiceTool.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.IoC 7 | { 8 | public static class ServiceTool 9 | { 10 | public static IServiceProvider ServiceProvider { get; private set; } 11 | 12 | public static IServiceCollection Create(IServiceCollection services) 13 | { 14 | ServiceProvider = services.BuildServiceProvider(); 15 | return services; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/User.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Entities.Concrete 7 | { 8 | public class User : IEntity 9 | { 10 | public int Id { get; set; } 11 | public string FirstName { get; set; } 12 | public string LastName { get; set; } 13 | public string EMail { get; set; } 14 | public byte[] PasswordHash { get; set; } 15 | public byte[] PasswordSalt { get; set; } 16 | public bool Status { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Business/Abstract/IBrandService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface IBrandService 11 | { 12 | IDataResult> GetAll(Expression> filter = null); 13 | IDataResult GetById(int id); 14 | IResult Add(Brand entity); 15 | IResult Update(Brand entity); 16 | IResult Delete(Brand entity); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Business/Abstract/IColorService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface IColorService 11 | { 12 | IDataResult> GetAll(Expression> filter = null); 13 | IDataResult GetById(int id); 14 | IResult Add(Color entity); 15 | IResult Update(Color entity); 16 | IResult Delete(Color entity); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Business/Abstract/IAuthService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using Entities.Dtos; 7 | using Core.Utilities.Security.Jwt; 8 | 9 | namespace Business.Abstract 10 | { 11 | public interface IAuthService 12 | { 13 | IDataResult Register(UserForRegisterDto userForRegisterDto); 14 | IDataResult Login(UserForLoginDto userForLoginDto); 15 | IResult UserExists(string email); 16 | IDataResult CreateAccessToken(User user); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Business/Abstract/ICustomerService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface ICustomerService 11 | { 12 | IDataResult> GetAll(Expression> filter = null); 13 | IDataResult GetById(int id); 14 | IResult Add(Customer entity); 15 | IResult Update(Customer entity); 16 | IResult Delete(Customer entity); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Business/Abstract/IRentalService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface IRentalService 11 | { 12 | IDataResult> GetAll(Expression> filter = null); 13 | IDataResult GetById(int id); 14 | IResult Add(Rental entity); 15 | IResult Update(Rental entity); 16 | IResult Delete(Rental entity); 17 | IDataResult GetAvailableCar(Rental entity); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Core/CrossCuttingConserns/Validation/ValidationTool.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.CrossCuttingConserns.Validation 7 | { 8 | public class ValidationTool 9 | { 10 | public static void Validate(IValidator validator, object entity) 11 | { 12 | var context = new ValidationContext(entity); 13 | var result = validator.Validate(context); 14 | if (result.Errors.Count > 0) 15 | { 16 | throw new ValidationException(result.Errors); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
#Kullanıcı NoŞirket Adı
{{customer.id}}{{customer.userId}}{{customer.companyName}}
20 | -------------------------------------------------------------------------------- /Business/Abstract/ICarImageService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq.Expressions; 6 | using System.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface ICarImageService 11 | { 12 | IDataResult> GetAll(Expression> filter = null); 13 | IDataResult GetById(int id); 14 | IResult Add(CarImage entity); 15 | IResult Update(CarImage entity); 16 | IResult Delete(CarImage entity); 17 | IDataResult> GetImagesByCarId(int carId); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Entities/Concrete/Car.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class Car : IEntity 9 | { 10 | public int Id { get; set; } 11 | public int BrandId { get; set; } 12 | public int ColorId { get; set; } 13 | public int ModelYear { get; set; } 14 | public Decimal DailyPrice { get; set; } 15 | public string Description { get; set; } 16 | 17 | public Brand Brand { get; set; } 18 | public Color Color { get; set; } 19 | 20 | public virtual List CarImages { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Business/Business.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/Mapping/CustomerMap.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework.Mapping 9 | { 10 | public class CustomerMap : IEntityTypeConfiguration 11 | { 12 | public void Configure(EntityTypeBuilder builder) 13 | { 14 | builder.ToTable(@"Customers", @"dbo"); 15 | builder.HasKey(x => x.Id); 16 | 17 | builder.Property(x => x.UserId).IsRequired(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Core/Utilities/Extensions/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.IoC; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Core.Utilities.Extensions 8 | { 9 | public static class ServiceCollectionExtensions 10 | { 11 | public static IServiceCollection AddDependencyResolvers(this IServiceCollection services, 12 | ICoreModule[] modules) 13 | { 14 | foreach (var module in modules) 15 | { 16 | module.Load(services); 17 | } 18 | 19 | return ServiceTool.Create(services); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/services/brand.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Brand } from '../models/brand'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class BrandService { 11 | 12 | apiUrl: string = "https://localhost:44358/api/"; 13 | 14 | constructor(private httpClient: HttpClient) { } 15 | 16 | getBrands(): Observable> { 17 | let newPath = this.apiUrl + "brands/getall"; 18 | return this.httpClient.get>(newPath); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/services/color.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Color } from '../models/color'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class ColorService { 11 | 12 | apiUrl: string = "https://localhost:44358/api/"; 13 | 14 | constructor(private httpClient: HttpClient) { } 15 | 16 | getColors(): Observable> { 17 | let newPath = this.apiUrl + "Colors/getall"; 18 | return this.httpClient.get>(newPath); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/services/car.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { CarDto } from '../models/carDto'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class CarService { 11 | 12 | apiUrl: string = "https://localhost:44358/api/"; 13 | 14 | constructor(private httpClient: HttpClient) { } 15 | 16 | getCars(): Observable> { 17 | let newPath = this.apiUrl + "cars/getcarsdetail"; 18 | return this.httpClient.get>(newPath); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/Mapping/BrandMap.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework.Mapping 9 | { 10 | public class BrandMap : IEntityTypeConfiguration 11 | { 12 | public void Configure(EntityTypeBuilder builder) 13 | { 14 | builder.ToTable(@"Brands", @"dbo"); 15 | builder.HasKey(x => x.Id); 16 | builder.HasMany(x => x.Cars); 17 | 18 | builder.Property(x => x.Name).HasMaxLength(50); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/services/rental.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Rental } from '../models/rental'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class RentalService { 11 | 12 | apiUrl: string = "https://localhost:44358/api/"; 13 | 14 | constructor(private httpClient: HttpClient) { } 15 | 16 | getRentals(): Observable> { 17 | let newPath = this.apiUrl + "rentals/getall"; 18 | return this.httpClient.get>(newPath); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Business/Abstract/IUserService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace Business.Abstract 10 | { 11 | public interface IUserService 12 | { 13 | IDataResult> GetAll(Expression> filter = null); 14 | IDataResult GetById(int id); 15 | IResult Add(User entity); 16 | IResult Update(User entity); 17 | IResult Delete(User entity); 18 | IDataResult GetByEMail(string eMail); 19 | IDataResult> GetClaims(User user); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/Mapping/ColorMap.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework.Mapping 9 | { 10 | public class ColorMap : IEntityTypeConfiguration 11 | { 12 | public void Configure(EntityTypeBuilder builder) 13 | { 14 | builder.ToTable(@"Colors", @"dbo"); 15 | builder.HasKey(x => x.Id); 16 | builder.HasMany(x => x.Cars); 17 | 18 | builder.Property(x => x.Name).HasMaxLength(50); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/services/customer.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Customer } from '../models/customer'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class CustomerService { 11 | 12 | apiUrl: string = "https://localhost:44358/api/"; 13 | 14 | constructor(private httpClient: HttpClient) { } 15 | 16 | getCustomers(): Observable> { 17 | let newPath = this.apiUrl + "customers/getall"; 18 | return this.httpClient.get>(newPath); 19 | } 20 | } -------------------------------------------------------------------------------- /Core/DataAccess/IEntityRepository.cs: -------------------------------------------------------------------------------- 1 | using Core.Entity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | 7 | namespace Core.DataAccess.Abstract 8 | { 9 | public interface IEntityRepository where T : class, IEntity, new() // IEntityRepository interface'ine verilecek tip bir class olmalı IEntity'den türemiş olmalı ve Intance'ı alınabilir olmalı. 10 | { 11 | List GetAll(Expression> filter = null); // zorunlu olmayan bir parametre. 12 | T Get(Expression> filter); 13 | T GetById(int id); 14 | void Add(T entity); 15 | void Update(T entity); 16 | void Delete(T entity); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Core/Utilities/Extensions/ClaimsPrincipalExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Claims; 5 | using System.Text; 6 | 7 | namespace Core.Utilities.Extensions 8 | { 9 | public static class ClaimsPrincipalExtensions 10 | { 11 | public static List Claims(this ClaimsPrincipal claimsPrincipal, string claimType) 12 | { 13 | var result = claimsPrincipal?.FindAll(claimType)?.Select(x => x.Value).ToList(); 14 | return result; 15 | } 16 | 17 | public static List ClaimRoles(this ClaimsPrincipal claimsPrincipal) 18 | { 19 | return claimsPrincipal?.Claims(ClaimTypes.Role); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/car/car.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
MarkaRenkModel YılıGünlük ÜcretAçıklama
{{car.brand}}{{car.color}}{{car.modelYear}}{{car.dailyPrice}}{{car.description}}
24 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/car/car.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarComponent } from './car.component'; 4 | 5 | describe('CarComponent', () => { 6 | let component: CarComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/Mapping/UserMap.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Entities.Concrete; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.EntityFramework.Mapping 10 | { 11 | public class UserMap : IEntityTypeConfiguration 12 | { 13 | public void Configure(EntityTypeBuilder builder) 14 | { 15 | builder.ToTable(@"Users", @"dbo"); 16 | builder.HasKey(x => x.Id); 17 | 18 | builder.Property(x => x.EMail).IsRequired(); 19 | builder.Property(x => x.PasswordHash).IsRequired(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/car/car.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { CarDto } from 'src/app/models/carDto'; 3 | import { CarService } from 'src/app/services/car.service'; 4 | 5 | @Component({ 6 | selector: 'app-car', 7 | templateUrl: './car.component.html', 8 | styleUrls: ['./car.component.css'] 9 | }) 10 | export class CarComponent implements OnInit { 11 | 12 | cars:CarDto[]=[]; 13 | dataLoaded=false; 14 | 15 | constructor(private carService: CarService) { } 16 | 17 | ngOnInit(): void { 18 | this.getCars(); 19 | } 20 | 21 | getCars(){ 22 | this.carService.getCars().subscribe(response=>{ 23 | this.cars = response.data; 24 | this.dataLoaded = true; 25 | }) 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/navi/navi.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NaviComponent } from './navi.component'; 4 | 5 | describe('NaviComponent', () => { 6 | let component: NaviComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ NaviComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NaviComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/brand/brand.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandComponent } from './brand.component'; 4 | 5 | describe('BrandComponent', () => { 6 | let component: BrandComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/color/color.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorComponent } from './color.component'; 4 | 5 | describe('ColorComponent', () => { 6 | let component: ColorComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/rental/rental.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RentalComponent } from './rental.component'; 4 | 5 | describe('RentalComponent', () => { 6 | let component: RentalComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RentalComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RentalComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /ConsoleUI/ConsoleUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | all 11 | runtime; build; native; contentfiles; analyzers; buildtransitive 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { browser, logging } from 'protractor'; 2 | import { AppPage } from './app.po'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', async () => { 12 | await page.navigateTo(); 13 | expect(await page.getTitleText()).toEqual('ReCapAngularUI app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/color/color.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Color } from 'src/app/models/color'; 3 | import { ColorService } from 'src/app/services/color.service'; 4 | 5 | @Component({ 6 | selector: 'app-color', 7 | templateUrl: './color.component.html', 8 | styleUrls: ['./color.component.css'] 9 | }) 10 | export class ColorComponent implements OnInit { 11 | 12 | colors:Color[]=[]; 13 | dataLoaded=false; 14 | 15 | constructor(private colorService:ColorService) { } 16 | 17 | ngOnInit(): void { 18 | this.getColors(); 19 | } 20 | 21 | getColors(){ 22 | this.colorService.getColors().subscribe(response=>{ 23 | this.colors = response.data; 24 | this.dataLoaded = true; 25 | }) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/rental/rental.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
#Araç NoMüşteri NoKiralama Tarihiİade Tarihi
{{rental.id}}{{rental.carId}}{{rental.customerId}}{{rental.rentDate}}{{rental.returnDate}}
24 | -------------------------------------------------------------------------------- /AngularUI/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AngularUI", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "dependencies": { 8 | "jquery": "^3.6.0" 9 | } 10 | }, 11 | "node_modules/jquery": { 12 | "version": "3.6.0", 13 | "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", 14 | "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" 15 | } 16 | }, 17 | "dependencies": { 18 | "jquery": { 19 | "version": "3.6.0", 20 | "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", 21 | "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/Mapping/RentalMap.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework.Mapping 9 | { 10 | public class RentalMap : IEntityTypeConfiguration 11 | { 12 | public void Configure(EntityTypeBuilder builder) 13 | { 14 | builder.ToTable(@"Rentals", @"dbo"); 15 | builder.HasKey(x => x.Id); 16 | 17 | builder.Property(x => x.CarId).IsRequired(); 18 | builder.Property(x => x.CustomerId).IsRequired(); 19 | builder.Property(x => x.RentDate).IsRequired(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Business/Abstract/ICarService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Entities.Dtos; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace Business.Abstract 10 | { 11 | public interface ICarService 12 | { 13 | IDataResult> GetAll(Expression> filter = null); 14 | IDataResult> GetByBrandId(int brandId); 15 | IDataResult> GetByColorId(int colorId); 16 | IDataResult> GetCarDTOs(); 17 | IDataResult GetCarDTO(int id); 18 | IDataResult GetById(int id); 19 | IResult Add(Car entity); 20 | IResult Update(Car entity); 21 | IResult Delete(Car entity); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/customer/customer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerComponent } from './customer.component'; 4 | 5 | describe('CustomerComponent', () => { 6 | let component: CustomerComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CustomerComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CustomerComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/rental/rental.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Rental } from 'src/app/models/rental'; 3 | import { RentalService } from 'src/app/services/rental.service'; 4 | 5 | @Component({ 6 | selector: 'app-rental', 7 | templateUrl: './rental.component.html', 8 | styleUrls: ['./rental.component.css'] 9 | }) 10 | export class RentalComponent implements OnInit { 11 | 12 | rentals:Rental[]=[]; 13 | dataLoaded=false; 14 | 15 | constructor(private rentalService:RentalService) { } 16 | 17 | ngOnInit(): void { 18 | this.getRentals(); 19 | } 20 | 21 | getRentals(){ 22 | this.rentalService.getRentals().subscribe(response=>{ 23 | this.rentals = response.data; 24 | this.dataLoaded = true; 25 | }) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Core/DependencyResolvers/CoreModule.cs: -------------------------------------------------------------------------------- 1 | using Core.CrossCuttingConserns.Caching; 2 | using Core.CrossCuttingConserns.Caching.Microsoft; 3 | using Core.Utilities.IoC; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Diagnostics; 9 | using System.Text; 10 | 11 | namespace Core.DependencyResolvers 12 | { 13 | public class CoreModule : ICoreModule 14 | { 15 | public void Load(IServiceCollection services) 16 | { 17 | services.AddMemoryCache(); 18 | services.AddSingleton(); 19 | services.AddSingleton(); 20 | services.AddSingleton(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Transaction/TransactionScopeAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.Utilities.Interceptors; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using System.Transactions; 7 | 8 | namespace Core.Aspects.Autofac.Transaction 9 | { 10 | public class TransactionScopeAspect : MethodInterception 11 | { 12 | public override void Intercept(IInvocation invocation) 13 | { 14 | using TransactionScope transactionScope = new TransactionScope(); 15 | try 16 | { 17 | invocation.Proceed(); 18 | transactionScope.Complete(); 19 | } 20 | catch (Exception) 21 | { 22 | transactionScope.Dispose(); 23 | throw; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/brand/brand.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Brand } from 'src/app/models/brand'; 4 | import { BrandService } from 'src/app/services/brand.service'; 5 | 6 | @Component({ 7 | selector: 'app-brand', 8 | templateUrl: './brand.component.html', 9 | styleUrls: ['./brand.component.css'] 10 | }) 11 | export class BrandComponent implements OnInit { 12 | 13 | brands:Brand[]=[]; 14 | dataLoaded=false; 15 | 16 | constructor(private brandService:BrandService) { } 17 | 18 | ngOnInit(): void { 19 | this.getBrands(); 20 | } 21 | 22 | getBrands(){ 23 | this.brandService.getBrands().subscribe(response=>{ 24 | this.brands = response.data; 25 | this.dataLoaded = true; 26 | }) 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/customer/customer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Customer } from 'src/app/models/customer'; 3 | import { CustomerService } from 'src/app/services/customer.service'; 4 | 5 | @Component({ 6 | selector: 'app-customer', 7 | templateUrl: './customer.component.html', 8 | styleUrls: ['./customer.component.css'] 9 | }) 10 | export class CustomerComponent implements OnInit { 11 | 12 | customers:Customer[]=[]; 13 | dataLoaded=false; 14 | 15 | constructor(private customerService:CustomerService) { } 16 | 17 | ngOnInit(): void { 18 | this.getCustomers(); 19 | } 20 | 21 | getCustomers(){ 22 | this.customerService.getCustomers().subscribe(response=>{ 23 | this.customers = response.data; 24 | this.dataLoaded = true; 25 | }) 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/AspectInterceptorSelector.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Reflection; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Core.Utilities.Interceptors 9 | { 10 | public class AspectInterceptorSelector : IInterceptorSelector 11 | { 12 | public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors) 13 | { 14 | var classAttributes = type.GetCustomAttributes(true).ToList(); 15 | var methodAttributes = type.GetMethod(method.Name).GetCustomAttributes(true); 16 | classAttributes.AddRange(methodAttributes); 17 | 18 | return classAttributes.OrderBy(x => x.Priority).ToArray(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/Mapping/CarImageMap.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework.Mapping 9 | { 10 | public class CarImageMap : IEntityTypeConfiguration 11 | { 12 | public void Configure(EntityTypeBuilder builder) 13 | { 14 | builder.ToTable(@"CarImages", @"dbo"); 15 | builder.HasKey(x => x.Id); 16 | 17 | builder.Property(x => x.CarId).IsRequired(); 18 | builder.Property(x => x.ImagePath).IsRequired(); 19 | builder.Property(x => x.ImagePath).HasMaxLength(256); 20 | builder.Property(x => x.Date).IsRequired(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /Core/Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /WebAPI/WebAPI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Caching/CacheRemoveAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.CrossCuttingConserns.Caching; 3 | using Core.Utilities.Interceptors; 4 | using Core.Utilities.IoC; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | 10 | namespace Core.Aspects.Autofac.Caching 11 | { 12 | public class CacheRemoveAspect : MethodInterception 13 | { 14 | private readonly string _pattern; 15 | private readonly ICacheManager _cacheManager; 16 | 17 | public CacheRemoveAspect(string pattern) 18 | { 19 | _pattern = pattern; 20 | _cacheManager = ServiceTool.ServiceProvider.GetService(); 21 | } 22 | protected override void OnSuccess(IInvocation invocation) 23 | { 24 | _cacheManager.RemovePattern(_pattern); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "sourceMap": true, 12 | "declaration": false, 13 | "downlevelIteration": true, 14 | "experimentalDecorators": true, 15 | "moduleResolution": "node", 16 | "importHelpers": true, 17 | "target": "es2015", 18 | "module": "es2020", 19 | "lib": [ 20 | "es2018", 21 | "dom" 22 | ] 23 | }, 24 | "angularCompilerOptions": { 25 | "enableI18nLegacyMessageIdFormat": false, 26 | "strictInjectionParameters": true, 27 | "strictInputAccessModifiers": true, 28 | "strictTemplates": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /WebAPI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:56683", 7 | "sslPort": 44358 8 | } 9 | }, 10 | "$schema": "http://json.schemastore.org/launchsettings.json", 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "swagger", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "WebAPI": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "launchUrl": "swagger", 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | }, 27 | "dotnetRunMessages": "true", 28 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { BrandComponent } from './components/brand/brand.component'; 4 | import { CarComponent } from './components/car/car.component'; 5 | import { ColorComponent } from './components/color/color.component'; 6 | import { CustomerComponent } from './components/customer/customer.component'; 7 | import { RentalComponent } from './components/rental/rental.component'; 8 | 9 | const routes: Routes = [ 10 | {path:"", pathMatch:"full", component:CarComponent}, 11 | {path:"cars", component:CarComponent}, 12 | {path:"brands", component:BrandComponent}, 13 | {path:"colors", component:ColorComponent}, 14 | {path:"customers", component:CustomerComponent}, 15 | {path:"rentals", component:RentalComponent} 16 | ]; 17 | 18 | @NgModule({ 19 | imports: [RouterModule.forRoot(routes)], 20 | exports: [RouterModule] 21 | }) 22 | export class AppRoutingModule { } 23 | -------------------------------------------------------------------------------- /DataAccess/DataAccess.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 6 | 7 | 8 | 9 | all 10 | runtime; build; native; contentfiles; analyzers; buildtransitive 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; -------------------------------------------------------------------------------- /Core/Utilities/Extensions/ClaimExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IdentityModel.Tokens.Jwt; 4 | using System.Linq; 5 | using System.Security.Claims; 6 | using System.Text; 7 | 8 | namespace Core.Utilities.Extensions 9 | { 10 | public static class ClaimExtensions 11 | { 12 | public static void AddMail(this ICollection claims, string email) 13 | { 14 | claims.Add(new Claim(JwtRegisteredClaimNames.Email, email)); 15 | } 16 | public static void AddName(this ICollection claims, string name) 17 | { 18 | claims.Add(new Claim(ClaimTypes.Name, name)); 19 | } 20 | public static void AddNameIdentifier(this ICollection claims, string nameIdentifier) 21 | { 22 | claims.Add(new Claim(ClaimTypes.NameIdentifier, nameIdentifier)); 23 | } 24 | public static void AddRoles(this ICollection claims, string[] roles) 25 | { 26 | roles.ToList().ForEach(role => claims.Add(new Claim(ClaimTypes.Role, role))); 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/README.md: -------------------------------------------------------------------------------- 1 | # ReCapAngularUI 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { HttpClientModule} from '@angular/common/http'; 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | import { BrandComponent } from './components/brand/brand.component'; 7 | import { ColorComponent } from './components/color/color.component'; 8 | import { CustomerComponent } from './components/customer/customer.component'; 9 | import { CarComponent } from './components/car/car.component'; 10 | import { NaviComponent } from './components/navi/navi.component'; 11 | import { RentalComponent } from './components/rental/rental.component'; 12 | 13 | @NgModule({ 14 | declarations: [ 15 | AppComponent, 16 | BrandComponent, 17 | ColorComponent, 18 | CustomerComponent, 19 | CarComponent, 20 | NaviComponent, 21 | RentalComponent 22 | ], 23 | imports: [ 24 | BrowserModule, 25 | AppRoutingModule, 26 | HttpClientModule 27 | ], 28 | providers: [], 29 | bootstrap: [AppComponent] 30 | }) 31 | export class AppModule { } 32 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/Mapping/CarMap.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework.Mapping 9 | { 10 | public class CarMap : IEntityTypeConfiguration 11 | { 12 | public void Configure(EntityTypeBuilder builder) 13 | { 14 | builder.ToTable(@"Cars", @"dbo") 15 | .HasKey(x => x.Id); 16 | 17 | //builder.HasOne(b => b.Brand) 18 | // .WithMany(c => c.Cars) 19 | // .HasForeignKey(f => f.BrandId); 20 | 21 | //builder.HasOne(cl => cl.Color) 22 | // .WithMany(c => c.Cars) 23 | // .HasForeignKey(f => f.ColorId); 24 | 25 | builder.Property(x => x.BrandId).IsRequired(); 26 | builder.Property(x => x.ColorId).IsRequired(); 27 | builder.Property(x => x.ModelYear).HasMaxLength(DateTime.Now.Year + 1); 28 | builder.Property(x => x.Description).HasMaxLength(int.MaxValue); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /WebAPI/Program.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Extensions.DependencyInjection; 3 | using Business.DependencySolvers.Autofac; 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.Extensions.Configuration; 6 | using Microsoft.Extensions.Hosting; 7 | using Microsoft.Extensions.Logging; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading.Tasks; 12 | 13 | namespace WebAPI 14 | { 15 | public class Program 16 | { 17 | public static void Main(string[] args) 18 | { 19 | CreateHostBuilder(args).Build().Run(); 20 | } 21 | 22 | public static IHostBuilder CreateHostBuilder(string[] args) => 23 | Host.CreateDefaultBuilder(args) 24 | .UseServiceProviderFactory(new AutofacServiceProviderFactory()) 25 | .ConfigureContainer(builder => 26 | { 27 | builder.RegisterModule(new AutofacBusinessModule()); 28 | }) 29 | .ConfigureWebHostDefaults(webBuilder => 30 | { 31 | webBuilder.UseStartup(); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'ReCapAngularUI'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('ReCapAngularUI'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement; 33 | expect(compiled.querySelector('.content span').textContent).toContain('ReCapAngularUI app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Performance/PerformanceAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.Utilities.Interceptors; 3 | using Core.Utilities.IoC; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Diagnostics; 8 | using System.Text; 9 | 10 | namespace Core.Aspects.Autofac.Performance 11 | { 12 | public class PerformanceAspect : MethodInterception 13 | { 14 | private readonly int _interval; 15 | private readonly Stopwatch _stopwatch; 16 | 17 | public PerformanceAspect(int interval) 18 | { 19 | _interval = interval; 20 | _stopwatch = ServiceTool.ServiceProvider.GetService(); 21 | } 22 | 23 | protected override void OnBefore(IInvocation invocation) 24 | { 25 | _stopwatch.Start(); 26 | } 27 | 28 | protected override void OnAfter(IInvocation invocation) 29 | { 30 | if (_stopwatch.Elapsed.TotalSeconds > _interval) 31 | { 32 | Debug.Print($"Performance : {invocation.Method.DeclaringType.FullName}.{invocation.Method.Name}-->{_stopwatch.Elapsed.TotalSeconds}"); 33 | } 34 | _stopwatch.Reset(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/MethodInterception.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Interceptors 7 | { 8 | public class MethodInterception : MethodInterceptionBaseAttribute 9 | { 10 | protected virtual void OnBefore(IInvocation invocation) { } 11 | protected virtual void OnAfter(IInvocation invocation) { } 12 | protected virtual void OnException(IInvocation invocation, Exception e) { } 13 | protected virtual void OnSuccess(IInvocation invocation) { } 14 | public override void Intercept(IInvocation invocation) 15 | { 16 | var isSuccess = true; 17 | OnBefore(invocation); 18 | try 19 | { 20 | invocation.Proceed(); 21 | } 22 | catch (Exception e) 23 | { 24 | isSuccess = false; 25 | OnException(invocation, e); 26 | throw; 27 | } 28 | finally 29 | { 30 | if (isSuccess) 31 | { 32 | OnSuccess(invocation); 33 | } 34 | } 35 | OnAfter(invocation); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Hashing/HashingHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Security.Hashing 6 | { 7 | public class HashingHelper 8 | { 9 | public static void CreatePasswordHash(string password, out byte[] passwordHash, out byte[] passwordSalt) 10 | { 11 | using (var hmac = new System.Security.Cryptography.HMACSHA512()) 12 | { 13 | passwordSalt = hmac.Key; 14 | passwordHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(password)); 15 | } 16 | } 17 | 18 | public static bool VerifyPasswordhash(string password, byte[] passwordHash, byte[] passwordSalt) 19 | { 20 | using (var hmac = new System.Security.Cryptography.HMACSHA512(passwordSalt)) 21 | { 22 | var computedHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(password)); 23 | for (int i = 0; i < computedHash.Length; i++) 24 | { 25 | if (computedHash[i] != passwordHash[i]) 26 | { 27 | return false; 28 | } 29 | } 30 | } 31 | return true; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using Core.Entities.Concrete; 3 | using DataAccess.Abstract; 4 | using DataAccess.Concrete.EntityFramework.Context; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using System.Linq; 9 | 10 | namespace DataAccess.Concrete.EntityFramework 11 | { 12 | public class EfUserDal : EfEntityRepositoryBase, IUserDal 13 | { 14 | public List GetClaims(User user) 15 | { 16 | using (var context = new ReCapContext()) 17 | { 18 | var result = from operationClaim in context.OperationClaims 19 | join userOperationClaim in context.UserOperationClaims 20 | on operationClaim.Id equals userOperationClaim.OperationClaimId 21 | where userOperationClaim.UserId == user.Id 22 | select new OperationClaim 23 | { 24 | Id = operationClaim.Id, 25 | Name = operationClaim.Name 26 | }; 27 | return result.ToList(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Validation/ValidationAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.CrossCuttingConserns.Validation; 3 | using Core.Utilities.Interceptors; 4 | using FluentValidation; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | 10 | namespace Core.Aspects.Autofac.Validation 11 | { 12 | public class ValidationAspect : MethodInterception 13 | { 14 | private Type _validatorType; 15 | 16 | public ValidationAspect(Type validatorType) 17 | { 18 | if (!typeof(IValidator).IsAssignableFrom(validatorType)) 19 | { 20 | throw new Exception("Bu bir doğrulama sınıfı değil"); 21 | } 22 | _validatorType = validatorType; 23 | } 24 | 25 | protected override void OnBefore(IInvocation invocation) 26 | { 27 | var validator = (IValidator)Activator.CreateInstance(_validatorType); 28 | var entityType = _validatorType.BaseType.GetGenericArguments()[0]; 29 | var entities = invocation.Arguments.Where(t => t.GetType() == entityType); 30 | foreach (var entity in entities) 31 | { 32 | ValidationTool.Validate(validator, entity); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/Context/ReCapContext.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using DataAccess.Concrete.EntityFramework.Mapping; 3 | using Entities.Concrete; 4 | using Microsoft.EntityFrameworkCore; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.EntityFramework.Context 10 | { 11 | public class ReCapContext : DbContext 12 | { 13 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 14 | { 15 | optionsBuilder.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=ReCapWebinarED;Integrated Security=True;"); 16 | } 17 | protected override void OnModelCreating(ModelBuilder modelBuilder) 18 | { 19 | modelBuilder.ApplyConfigurationsFromAssembly(typeof(CarMap).Assembly); 20 | } 21 | 22 | public DbSet Cars { get; set; } 23 | public DbSet Colors { get; set; } 24 | public DbSet Brands { get; set; } 25 | public DbSet Users { get; set; } 26 | public DbSet Customers { get; set; } 27 | public DbSet Rentals { get; set; } 28 | public DbSet CarImages { get; set; } 29 | public DbSet OperationClaims { get; set; } 30 | public DbSet UserOperationClaims { get; set; } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Business/Constants/Messages.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Business.Constants 6 | { 7 | public static class Messages 8 | { 9 | public static string BrandAdded = "Marka eklendi"; 10 | public static string BrandExists = "Marka önceden mevcut"; 11 | public static string NoCarAvailable = "Seçilen araç müsait değil"; 12 | public static string CarRented = "Araç kiralama başarılı"; 13 | public static string SuccessRentUpdate = "Kira güncelleme başarılı"; 14 | public static string ErrorRentUpdate = "Kira güncelleme başarısız"; 15 | public static string CarImageAdded = "Araç fotoğrafı eklendi"; 16 | public static string CarImageLimitExceded = "Maksimum fotoğraf sayısına ulaşıldı"; 17 | public static string CarImageDeleted = "Araç fotoğrafı silindi"; 18 | public static string CarImageUpdated = "Araç fotoğrafı güncellendi"; 19 | public static string UserNotFound = "Kullanıcı bulunamadı"; 20 | public static string PasswordError = "Şifre hatalı"; 21 | public static string SuccessfullLogin = "Sisteme giriş başarılı."; 22 | public static string UserAlreadyExists="Bu kullanıcı zaten mevcut."; 23 | public static string UserRegistered="Kullanıcı başarıyla kaydedildi"; 24 | public static string AccessTokenCreated ="Access token başarıyla oluşturuldu."; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Caching/CacheAspect.cs: -------------------------------------------------------------------------------- 1 | using Core.CrossCuttingConserns.Caching; 2 | using Core.Utilities.Interceptors; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Core.Utilities.IoC; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using Castle.DynamicProxy; 9 | using System.Linq; 10 | 11 | namespace Core.Aspects.Autofac.Caching 12 | { 13 | public class CacheAspect : MethodInterception 14 | { 15 | private readonly int _duration; 16 | private readonly ICacheManager _cacheManager; 17 | 18 | public CacheAspect(int duration = 60) 19 | { 20 | _duration = duration; 21 | _cacheManager = ServiceTool.ServiceProvider.GetService(); 22 | } 23 | 24 | public override void Intercept(IInvocation invocation) 25 | { 26 | var methodName = string.Format($"{invocation.Method.ReflectedType.FullName}.{invocation.Method.Name}"); 27 | var arguments = invocation.Arguments.ToList(); 28 | var key = $"{methodName}({string.Join(",", arguments.Select(x => x?.ToString() ?? ""))})"; 29 | if (_cacheManager.IsAdd(key)) 30 | { 31 | invocation.ReturnValue = _cacheManager.Get(key); 32 | return; 33 | } 34 | invocation.Proceed(); 35 | _cacheManager.Add(key, invocation.ReturnValue, _duration); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Business/DependencySolvers/BusinessModule.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Concrete; 3 | using DataAccess.Abstract; 4 | using DataAccess.Concrete.EntityFramework; 5 | using DataAccess.Concrete.InMemory; 6 | using Ninject.Modules; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | 11 | namespace Business.DependencySolvers 12 | { 13 | public class BusinessModule : NinjectModule 14 | { 15 | public override void Load() 16 | { 17 | Bind().To().InSingletonScope(); 18 | Bind().To().InSingletonScope(); 19 | 20 | Bind().To().InSingletonScope(); 21 | Bind().To().InSingletonScope(); 22 | 23 | Bind().To().InSingletonScope(); 24 | Bind().To().InSingletonScope(); 25 | 26 | Bind().To().InSingletonScope(); 27 | Bind().To().InSingletonScope(); 28 | 29 | Bind().To().InSingletonScope(); 30 | Bind().To().InSingletonScope(); 31 | 32 | Bind().To().InSingletonScope(); 33 | Bind().To().InSingletonScope(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "re-cap-angular-ui", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~11.2.4", 15 | "@angular/common": "~11.2.4", 16 | "@angular/compiler": "~11.2.4", 17 | "@angular/core": "~11.2.4", 18 | "@angular/forms": "~11.2.4", 19 | "@angular/platform-browser": "~11.2.4", 20 | "@angular/platform-browser-dynamic": "~11.2.4", 21 | "@angular/router": "~11.2.4", 22 | "bootstrap": "^5.0.0-beta2", 23 | "jquery": "^3.6.0", 24 | "rxjs": "~6.6.0", 25 | "tslib": "^2.0.0", 26 | "zone.js": "~0.11.3" 27 | }, 28 | "devDependencies": { 29 | "@angular-devkit/build-angular": "~0.1102.3", 30 | "@angular/cli": "~11.2.3", 31 | "@angular/compiler-cli": "~11.2.4", 32 | "@types/jasmine": "~3.6.0", 33 | "@types/node": "^12.11.1", 34 | "codelyzer": "^6.0.0", 35 | "jasmine-core": "~3.6.0", 36 | "jasmine-spec-reporter": "~5.0.0", 37 | "karma": "~6.1.0", 38 | "karma-chrome-launcher": "~3.1.0", 39 | "karma-coverage": "~2.0.3", 40 | "karma-jasmine": "~4.0.0", 41 | "karma-jasmine-html-reporter": "^1.5.0", 42 | "protractor": "~7.0.0", 43 | "ts-node": "~8.3.0", 44 | "tslint": "~6.1.0", 45 | "typescript": "~4.1.5" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/ReCapAngularUI'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /Business/Concrete/ColorManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Utilities.Results; 3 | using DataAccess.Abstract; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq.Expressions; 8 | using System.Text; 9 | 10 | namespace Business.Concrete 11 | { 12 | public class ColorManager : IColorService 13 | { 14 | private readonly IColorDal _colorDal; 15 | 16 | public ColorManager(IColorDal brandDal) 17 | { 18 | _colorDal = brandDal; 19 | } 20 | 21 | public IResult Add(Color entity) 22 | { 23 | if (_colorDal.Get(x => x.Name == entity.Name) == null) 24 | { 25 | _colorDal.Add(entity); 26 | return new SuccessResult(); 27 | } 28 | return new ErrorResult(); 29 | } 30 | 31 | public IResult Delete(Color entity) 32 | { 33 | var color = _colorDal.GetById(entity.Id); 34 | if (color == null) return new ErrorResult(); 35 | _colorDal.Delete(color); 36 | return new SuccessResult(); 37 | } 38 | 39 | public IDataResult> GetAll(Expression> filter = null) 40 | { 41 | return new SuccessDataResult>(_colorDal.GetAll(filter)); 42 | } 43 | 44 | public IDataResult GetById(int id) 45 | { 46 | return new SuccessDataResult(_colorDal.GetById(id)); 47 | } 48 | 49 | public IResult Update(Color entity) 50 | { 51 | _colorDal.Update(entity); 52 | return new SuccessResult(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /DataAccess/Concrete/InMemory/MemColorDal.cs: -------------------------------------------------------------------------------- 1 | using DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.InMemory 10 | { 11 | public class MemColorDal : IColorDal 12 | { 13 | private List _colors; 14 | public MemColorDal() 15 | { 16 | _colors = new List 17 | { 18 | new Color{Id = 1, Name="Mavi"}, 19 | new Color{Id = 2, Name="Kırmızı"}, 20 | new Color{Id = 3, Name="Beyaz"} 21 | }; 22 | } 23 | public void Add(Color entity) 24 | { 25 | entity.Id = _colors.Max(x => x.Id) + 1; 26 | _colors.Add(entity); 27 | } 28 | 29 | public void Delete(Color entity) 30 | { 31 | _colors.Remove(entity); 32 | } 33 | 34 | public Color Get(Expression> filter) 35 | { 36 | return _colors.SingleOrDefault(filter.Compile()); 37 | } 38 | 39 | public List GetAll(Expression> filter = null) 40 | { 41 | return filter == null ? _colors : _colors.Where(filter.Compile()).ToList(); 42 | } 43 | 44 | public Color GetById(int id) 45 | { 46 | return _colors.SingleOrDefault(c => c.Id == id); 47 | } 48 | 49 | public void Update(Color entity) 50 | { 51 | var color = _colors.SingleOrDefault(c => c.Id == entity.Id); 52 | if (color == null) throw new NullReferenceException("Güncellenecek renk bulunamadı"); 53 | color.Name = entity.Name; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Business/Concrete/CustomerManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Utilities.Results; 3 | using DataAccess.Abstract; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq.Expressions; 8 | using System.Text; 9 | 10 | namespace Business.Concrete 11 | { 12 | public class CustomerManager : ICustomerService 13 | { 14 | private readonly ICustomerDal _customerDal; 15 | 16 | public CustomerManager(ICustomerDal customerDal) 17 | { 18 | _customerDal = customerDal; 19 | } 20 | 21 | public IResult Add(Customer entity) 22 | { 23 | _customerDal.Add(entity); 24 | return new SuccessResult(); 25 | } 26 | 27 | public IResult Delete(Customer entity) 28 | { 29 | var customerToDelete = _customerDal.GetById(entity.Id); 30 | if (customerToDelete == null) return new ErrorResult(); 31 | _customerDal.Delete(customerToDelete); 32 | return new SuccessResult(); 33 | } 34 | 35 | public IDataResult> GetAll(Expression> filter = null) 36 | { 37 | return new SuccessDataResult>(_customerDal.GetAll(filter)); 38 | } 39 | 40 | public IDataResult GetById(int id) 41 | { 42 | return new SuccessDataResult(_customerDal.GetById(id)); 43 | } 44 | 45 | public IResult Update(Customer entity) 46 | { 47 | var customerToUpdate = _customerDal.GetById(entity.Id); 48 | if (customerToUpdate == null) return new ErrorResult(); 49 | _customerDal.Update(customerToUpdate); 50 | return new SuccessResult(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /DataAccess/Concrete/InMemory/MemBrandDal.cs: -------------------------------------------------------------------------------- 1 | using DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.InMemory 10 | { 11 | public class MemBrandDal : IBrandDal 12 | { 13 | private List _brands; 14 | public MemBrandDal() 15 | { 16 | _brands = new List 17 | { 18 | new Brand{Id = 1, Name = "Mercedes"}, 19 | new Brand{Id = 2, Name = "Skoda"}, 20 | new Brand{Id = 3, Name = "Volkswagen"} 21 | }; 22 | } 23 | public void Add(Brand entity) 24 | { 25 | entity.Id = _brands.Max(x => x.Id) + 1; 26 | _brands.Add(entity); 27 | } 28 | 29 | public void Delete(Brand entity) 30 | { 31 | _brands.Remove(entity); 32 | } 33 | 34 | public Brand Get(Expression> filter) 35 | { 36 | return _brands.SingleOrDefault(filter.Compile()); 37 | } 38 | 39 | public List GetAll(Expression> filter = null) 40 | { 41 | return filter == null ? _brands : _brands.Where(filter.Compile()).ToList(); 42 | } 43 | 44 | public Brand GetById(int id) 45 | { 46 | return _brands.SingleOrDefault(x => x.Id == id); 47 | } 48 | 49 | public void Update(Brand entity) 50 | { 51 | var brand = _brands.SingleOrDefault(x => x.Id == entity.Id); 52 | if (brand == null) throw new NullReferenceException("Güncellenecek marka bulunamadı"); 53 | brand.Name = entity.Name; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /WebAPI/Utilities/ImageUploader.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.AspNetCore.Http; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace WebAPI.Utilities 10 | { 11 | public class ImageUploader 12 | { 13 | public static Task ImageUpload(string path, IFormFile file) 14 | { 15 | return Task.Run(() => 16 | { 17 | try 18 | { 19 | if (!Directory.Exists(path)) Directory.CreateDirectory(path); 20 | 21 | var randomFileName = Path.GetRandomFileName(); 22 | var fileExtension = Path.GetExtension(file.FileName).ToLower(); 23 | var fileName = Path.ChangeExtension(randomFileName, fileExtension); 24 | var filePath = Path.Combine(path, fileName); 25 | 26 | using (FileStream fileStream = File.Create(filePath)) 27 | { 28 | file.CopyTo(fileStream); 29 | fileStream.Flush(); 30 | return fileName; 31 | }; 32 | } 33 | catch (Exception ex) 34 | { 35 | throw new Exception(ex.Message); 36 | } 37 | }); 38 | } 39 | 40 | public static Task ImageDelete(string path) 41 | { 42 | return Task.Run(() => 43 | { 44 | try 45 | { 46 | File.Delete(path); 47 | } 48 | catch (Exception ex) 49 | { 50 | throw new Exception("Seçili dosya silinemedi! " + ex.Message); 51 | } 52 | }); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /WebAPI/Controllers/AuthController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Dtos; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class AuthController : ControllerBase 15 | { 16 | private readonly IAuthService _authService; 17 | 18 | public AuthController(IAuthService authService) 19 | { 20 | _authService = authService; 21 | } 22 | 23 | [HttpPost("login")] 24 | public IActionResult Login(UserForLoginDto userForLoginDto) 25 | { 26 | var userToLogin = _authService.Login(userForLoginDto); 27 | if (!userToLogin.Success) 28 | { 29 | return BadRequest(userToLogin.Message); 30 | } 31 | var result = _authService.CreateAccessToken(userToLogin.Data); 32 | if (result.Success) 33 | { 34 | return Ok(result.Data); 35 | } 36 | return BadRequest(result.Message); 37 | } 38 | 39 | [HttpPost("register")] 40 | public IActionResult Register(UserForRegisterDto userForRegisterDto) 41 | { 42 | var userExists = _authService.UserExists(userForRegisterDto.EMail); 43 | if (!userExists.Success) 44 | { 45 | return BadRequest(userExists.Message); 46 | } 47 | 48 | var registerResult = _authService.Register(userForRegisterDto); 49 | var result = _authService.CreateAccessToken(registerResult.Data); 50 | 51 | if (result.Success) 52 | { 53 | return Ok(result.Data); 54 | } 55 | return BadRequest(result.Message); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Business/Concrete/BrandManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Business.ValidationRules.FluentValidation; 4 | using Core.Aspects.Autofac.Validation; 5 | using Core.CrossCuttingConserns.Validation; 6 | using Core.Utilities.Results; 7 | using DataAccess.Abstract; 8 | using Entities.Concrete; 9 | using FluentValidation; 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq.Expressions; 13 | using System.Text; 14 | 15 | namespace Business.Concrete 16 | { 17 | public class BrandManager : IBrandService 18 | { 19 | private readonly IBrandDal _brandDal; 20 | 21 | public BrandManager(IBrandDal brandDal) 22 | { 23 | _brandDal = brandDal; 24 | } 25 | 26 | [ValidationAspect(typeof(BrandValidator))] 27 | public IResult Add(Brand entity) 28 | { 29 | //ValidationTool.Validate(new BrandValidator(), entity); 30 | if (_brandDal.Get(x => x.Name == entity.Name) == null) 31 | { 32 | _brandDal.Add(entity); 33 | return new SuccessResult(Messages.BrandAdded); 34 | } 35 | return new ErrorResult(Messages.BrandExists); 36 | } 37 | 38 | public IResult Delete(Brand entity) 39 | { 40 | var brand = _brandDal.GetById(entity.Id); 41 | if (brand == null) return new ErrorResult(); 42 | _brandDal.Delete(brand); 43 | return new SuccessResult(); 44 | } 45 | 46 | public IDataResult> GetAll(Expression> filter = null) 47 | { 48 | return new SuccessDataResult>(_brandDal.GetAll(filter)); 49 | } 50 | 51 | public IDataResult GetById(int id) 52 | { 53 | return new SuccessDataResult(_brandDal.GetById(id)); 54 | } 55 | 56 | public IResult Update(Brand entity) 57 | { 58 | _brandDal.Update(entity); 59 | return new SuccessResult(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /WebAPI/Controllers/ColorsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class ColorsController : ControllerBase 15 | { 16 | IColorService _colorService; 17 | 18 | public ColorsController(IColorService colorService) 19 | { 20 | _colorService = colorService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult Get() 25 | { 26 | var result = _colorService.GetAll(); 27 | if (result.Success) 28 | return Ok(result); 29 | return BadRequest(result); 30 | } 31 | 32 | [HttpGet("getbyid")] 33 | public IActionResult Get(int id) 34 | { 35 | var result = _colorService.GetById(id); 36 | if (result.Success) 37 | return Ok(result); 38 | return BadRequest(result); 39 | } 40 | 41 | [HttpPost("add")] 42 | public IActionResult Post(Color color) 43 | { 44 | var result = _colorService.Add(color); 45 | if (result.Success) 46 | return Ok(result); 47 | return BadRequest(result); 48 | } 49 | 50 | [HttpPost("update")] 51 | public IActionResult PostUpdate(Color color) 52 | { 53 | var result = _colorService.Update(color); 54 | if (result.Success) 55 | return Ok(result); 56 | return BadRequest(result); 57 | } 58 | 59 | [HttpPost("delete")] 60 | public IActionResult PostDelete(Color color) 61 | { 62 | var result = _colorService.Delete(color); 63 | if (result.Success) 64 | return Ok(result); 65 | return BadRequest(result); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Business/Concrete/UserManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Entities.Concrete; 3 | using Core.Utilities.Results; 4 | using DataAccess.Abstract; 5 | using Entities.Concrete; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq.Expressions; 9 | using System.Text; 10 | 11 | namespace Business.Concrete 12 | { 13 | public class UserManager : IUserService 14 | { 15 | private readonly IUserDal _userDal; 16 | 17 | public UserManager(IUserDal userDal) 18 | { 19 | _userDal = userDal; 20 | } 21 | 22 | public IResult Add(User entity) 23 | { 24 | _userDal.Add(entity); 25 | return new SuccessResult(); 26 | } 27 | 28 | public IResult Delete(User entity) 29 | { 30 | var userToDelete = _userDal.GetById(entity.Id); 31 | if (userToDelete == null) return new ErrorResult(); 32 | _userDal.Delete(userToDelete); 33 | return new SuccessResult(); 34 | } 35 | 36 | public IDataResult> GetAll(Expression> filter = null) 37 | { 38 | return new SuccessDataResult>(_userDal.GetAll(filter)); 39 | } 40 | 41 | public IDataResult GetByEMail(string eMail) 42 | { 43 | return new SuccessDataResult(_userDal.Get(x => x.EMail == eMail)); 44 | } 45 | 46 | public IDataResult GetById(int id) 47 | { 48 | return new SuccessDataResult(_userDal.GetById(id)); 49 | } 50 | 51 | public IDataResult> GetClaims(User user) 52 | { 53 | return new SuccessDataResult>(_userDal.GetClaims(user)); 54 | } 55 | 56 | public IResult Update(User entity) 57 | { 58 | var userToUpdate = _userDal.GetById(entity.Id); 59 | if (userToUpdate == null) return new ErrorResult(); 60 | _userDal.Update(userToUpdate); 61 | return new SuccessResult(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /WebAPI/Controllers/UsersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Entities.Concrete; 3 | using Entities.Concrete; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.AspNetCore.Mvc; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Threading.Tasks; 10 | 11 | namespace WebAPI.Controllers 12 | { 13 | [Route("api/[controller]")] 14 | [ApiController] 15 | public class UsersController : ControllerBase 16 | { 17 | IUserService _userService; 18 | 19 | public UsersController(IUserService userService) 20 | { 21 | _userService = userService; 22 | } 23 | 24 | [HttpGet("getall")] 25 | public IActionResult Get() 26 | { 27 | var result = _userService.GetAll(); 28 | if (result.Success) 29 | return Ok(result); 30 | return BadRequest(result); 31 | } 32 | 33 | [HttpGet("getbyid")] 34 | public IActionResult Get(int id) 35 | { 36 | var result = _userService.GetById(id); 37 | if (result.Success) 38 | return Ok(result); 39 | return BadRequest(result); 40 | } 41 | 42 | [HttpPost("add")] 43 | public IActionResult Post(User user) 44 | { 45 | var result = _userService.Add(user); 46 | if (result.Success) 47 | return Ok(result); 48 | return BadRequest(result); 49 | } 50 | 51 | [HttpPost("update")] 52 | public IActionResult PostUpdate(User user) 53 | { 54 | var result = _userService.Update(user); 55 | if (result.Success) 56 | return Ok(result); 57 | return BadRequest(result); 58 | } 59 | 60 | [HttpPost("delete")] 61 | public IActionResult PostDelete(User user) 62 | { 63 | var result = _userService.Delete(user); 64 | if (result.Success) 65 | return Ok(result); 66 | return BadRequest(result); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /WebAPI/Controllers/BrandsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | 13 | [Route("api/[controller]")] 14 | [ApiController] 15 | public class BrandsController : ControllerBase 16 | { 17 | IBrandService _brandService; 18 | 19 | public BrandsController(IBrandService brandService) 20 | { 21 | _brandService = brandService; 22 | } 23 | 24 | [HttpGet("getall")] 25 | public IActionResult Get() 26 | { 27 | var result = _brandService.GetAll(); 28 | if (result.Success) 29 | return Ok(result); 30 | return BadRequest(result); 31 | } 32 | 33 | [HttpGet("getbyid")] 34 | public IActionResult Get(int id) 35 | { 36 | var result = _brandService.GetById(id); 37 | if (result.Success) 38 | { 39 | return Ok(result); 40 | } 41 | return BadRequest(result); 42 | } 43 | 44 | [HttpPost("add")] 45 | public IActionResult Post(Brand brand) 46 | { 47 | var result = _brandService.Add(brand); 48 | if (result.Success) 49 | return Ok(result); 50 | return BadRequest(result); 51 | } 52 | 53 | [HttpPost("update")] 54 | public IActionResult PostUpdate(Brand brand) 55 | { 56 | var result = _brandService.Update(brand); 57 | if (result.Success) 58 | return Ok(result); 59 | return BadRequest(result); 60 | } 61 | 62 | [HttpPost("delete")] 63 | public IActionResult PostDelete(Brand brand) 64 | { 65 | var result = _brandService.Delete(brand); 66 | if (result.Success) 67 | return Ok(result); 68 | return BadRequest(result); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CustomersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class CustomersController : ControllerBase 15 | { 16 | ICustomerService _customerService; 17 | 18 | public CustomersController(ICustomerService customerService) 19 | { 20 | _customerService = customerService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult Get() 25 | { 26 | var result = _customerService.GetAll(); 27 | if (result.Success) 28 | return Ok(result); 29 | return BadRequest(result); 30 | } 31 | 32 | [HttpGet("getbyid")] 33 | public IActionResult Get(int id) 34 | { 35 | var result = _customerService.GetById(id); 36 | if (result.Success) 37 | return Ok(result); 38 | return BadRequest(result); 39 | } 40 | 41 | [HttpPost("add")] 42 | public IActionResult Post(Customer customer) 43 | { 44 | var result = _customerService.Add(customer); 45 | if (result.Success) 46 | return Ok(result); 47 | return BadRequest(result); 48 | } 49 | 50 | [HttpPost("update")] 51 | public IActionResult PostUpdate(Customer customer) 52 | { 53 | var result = _customerService.Update(customer); 54 | if (result.Success) 55 | return Ok(result); 56 | return BadRequest(result); 57 | } 58 | 59 | [HttpPost("delete")] 60 | public IActionResult PostDelete(Customer customer) 61 | { 62 | var result = _customerService.Delete(customer); 63 | if (result.Success) 64 | return Ok(result); 65 | return BadRequest(result); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Core/DataAccess/EntityFramework/EfEntityRepositoryBase.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.Abstract; 2 | using Core.Entity; 3 | using Microsoft.EntityFrameworkCore; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Linq.Expressions; 8 | using System.Text; 9 | 10 | namespace Core.DataAccess.EntityFramework 11 | { 12 | public class EfEntityRepositoryBase : IEntityRepository where TEntity : class, IEntity, new() where TContext : DbContext, new() 13 | { 14 | public void Add(TEntity entity) 15 | { 16 | using (var context = new TContext()) 17 | { 18 | context.Entry(entity).State = EntityState.Added; 19 | context.SaveChanges(); 20 | } 21 | } 22 | 23 | public void Delete(TEntity entity) 24 | { 25 | using (var context = new TContext()) 26 | { 27 | context.Entry(entity).State = EntityState.Deleted; 28 | context.SaveChanges(); 29 | } 30 | } 31 | 32 | public TEntity Get(Expression> filter) 33 | { 34 | using (var context = new TContext()) 35 | { 36 | return context.Set().SingleOrDefault(filter); 37 | } 38 | } 39 | 40 | public List GetAll(Expression> filter = null) 41 | { 42 | using (var context = new TContext()) 43 | { 44 | return filter == null ? context.Set().ToList() : context.Set().Where(filter).ToList(); 45 | } 46 | } 47 | 48 | public TEntity GetById(int id) 49 | { 50 | using (var context = new TContext()) 51 | { 52 | return context.Set().Find(id); 53 | } 54 | } 55 | 56 | public void Update(TEntity entity) 57 | { 58 | using (var context = new TContext()) 59 | { 60 | context.Entry(entity).State = EntityState.Modified; 61 | context.SaveChanges(); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | 38 | -------------------------------------------------------------------------------- /Business/Concrete/RentalManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Core.Utilities.Results; 4 | using DataAccess.Abstract; 5 | using Entities.Concrete; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq.Expressions; 9 | using System.Text; 10 | 11 | namespace Business.Concrete 12 | { 13 | public class RentalManager : IRentalService 14 | { 15 | private readonly IRentalDal _rentalDal; 16 | 17 | public RentalManager(IRentalDal rentalDal) 18 | { 19 | _rentalDal = rentalDal; 20 | } 21 | 22 | public IResult Add(Rental entity) 23 | { 24 | var carAvaliableForHire = _rentalDal.Get(x => x.CarId == entity.CarId && x.ReturnDate != null); 25 | if (carAvaliableForHire == null) return new ErrorResult(Messages.NoCarAvailable); 26 | _rentalDal.Add(entity); 27 | return new SuccessResult(Messages.CarRented); 28 | } 29 | 30 | public IResult Delete(Rental entity) 31 | { 32 | var rentalToDelete = _rentalDal.GetById(entity.Id); 33 | if (rentalToDelete == null) return new ErrorResult(); 34 | _rentalDal.Delete(rentalToDelete); 35 | return new SuccessResult(); 36 | } 37 | 38 | public IDataResult> GetAll(Expression> filter = null) 39 | { 40 | return new SuccessDataResult>(_rentalDal.GetAll(filter)); 41 | } 42 | 43 | public IDataResult GetAvailableCar(Rental entity) 44 | { 45 | return new SuccessDataResult(_rentalDal.Get(x => x.CarId == entity.CarId && x.ReturnDate != null)); 46 | } 47 | 48 | public IDataResult GetById(int id) 49 | { 50 | return new SuccessDataResult(_rentalDal.GetById(id)); 51 | } 52 | 53 | public IResult Update(Rental entity) 54 | { 55 | var rentalToUpdate = _rentalDal.GetById(entity.Id); 56 | if (rentalToUpdate == null) return new ErrorResult(Messages.ErrorRentUpdate); 57 | _rentalDal.Update(entity); 58 | return new SuccessResult(Messages.SuccessRentUpdate); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Business/Concrete/CarImageManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Core.Utilities.Business; 4 | using Core.Utilities.Results; 5 | using DataAccess.Abstract; 6 | using Entities.Concrete; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq.Expressions; 10 | using System.Text; 11 | 12 | namespace Business.Concrete 13 | { 14 | public class CarImageManager : ICarImageService 15 | { 16 | private readonly ICarImageDal _carImageDal; 17 | 18 | public CarImageManager(ICarImageDal carImageDal) 19 | { 20 | _carImageDal = carImageDal; 21 | } 22 | 23 | public IResult Add(CarImage entity) 24 | { 25 | var result = BusinessRules.Run(CheckIfCarLimitExceded(entity)); 26 | if (result != null) 27 | return result; 28 | entity.Date = DateTime.Now; 29 | _carImageDal.Add(entity); 30 | return new SuccessResult(Messages.CarImageAdded); 31 | } 32 | 33 | public IResult Delete(CarImage entity) 34 | { 35 | _carImageDal.Delete(entity); 36 | return new SuccessResult(Messages.CarImageDeleted); 37 | } 38 | 39 | public IDataResult> GetAll(Expression> filter = null) 40 | { 41 | return new SuccessDataResult>(_carImageDal.GetAll(filter)); 42 | } 43 | 44 | public IDataResult GetById(int id) 45 | { 46 | return new SuccessDataResult(_carImageDal.GetById(id)); 47 | } 48 | 49 | public IDataResult> GetImagesByCarId(int carId) 50 | { 51 | return new SuccessDataResult>(_carImageDal.GetAll(x => x.CarId == carId)); 52 | } 53 | 54 | public IResult Update(CarImage entity) 55 | { 56 | _carImageDal.Update(entity); 57 | return new SuccessResult(Messages.CarImageUpdated); 58 | } 59 | private IResult CheckIfCarLimitExceded(CarImage carImage) 60 | { 61 | var result = _carImageDal.GetAll(x => x.CarId == carImage.CarId).Count; 62 | if (result >= 5) 63 | return new ErrorResult(Messages.CarImageLimitExceded); 64 | return new SuccessResult(); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /WebAPI/Controllers/RentalsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class RentalsController : ControllerBase 15 | { 16 | IRentalService _rentalService; 17 | 18 | public RentalsController(IRentalService rentalService) 19 | { 20 | _rentalService = rentalService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult Get() 25 | { 26 | var result = _rentalService.GetAll(); 27 | if (result.Success) 28 | return Ok(result); 29 | return BadRequest(result); 30 | } 31 | 32 | [HttpGet("getbyid")] 33 | public IActionResult Get(int id) 34 | { 35 | var result = _rentalService.GetById(id); 36 | if (result.Success) 37 | return Ok(result); 38 | return BadRequest(result); 39 | } 40 | 41 | [HttpGet("getavaliablecar")] 42 | public IActionResult Get(Rental rental) 43 | { 44 | var result = _rentalService.GetAvailableCar(rental); 45 | if (result.Success) 46 | return Ok(result); 47 | return BadRequest(result); 48 | } 49 | 50 | [HttpPost("add")] 51 | public IActionResult Post(Rental rental) 52 | { 53 | var result = _rentalService.Add(rental); 54 | if (result.Success) 55 | return Ok(result); 56 | return BadRequest(result); 57 | } 58 | 59 | [HttpPost("update")] 60 | public IActionResult PostUpdate(Rental rental) 61 | { 62 | var result = _rentalService.Update(rental); 63 | if (result.Success) 64 | return Ok(result); 65 | return BadRequest(result); 66 | } 67 | 68 | [HttpPost("delete")] 69 | public IActionResult PostDelete(Rental rental) 70 | { 71 | var result = _rentalService.Delete(rental); 72 | if (result.Success) 73 | return Ok(result); 74 | return BadRequest(result); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Business/DependencySolvers/Autofac/AutofacBusinessModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Extras.DynamicProxy; 3 | using Business.Abstract; 4 | using Business.Concrete; 5 | using Core.Utilities.Interceptors; 6 | using Core.Utilities.Security.Jwt; 7 | using DataAccess.Abstract; 8 | using DataAccess.Concrete.EntityFramework; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Text; 12 | 13 | namespace Business.DependencySolvers.Autofac 14 | { 15 | public class AutofacBusinessModule : Module 16 | { 17 | protected override void Load(ContainerBuilder builder) 18 | { 19 | builder.RegisterType().As().SingleInstance(); 20 | builder.RegisterType().As().SingleInstance(); 21 | 22 | builder.RegisterType().As().SingleInstance(); 23 | builder.RegisterType().As().SingleInstance(); 24 | 25 | builder.RegisterType().As().SingleInstance(); 26 | builder.RegisterType().As().SingleInstance(); 27 | 28 | builder.RegisterType().As().SingleInstance(); 29 | builder.RegisterType().As().SingleInstance(); 30 | 31 | builder.RegisterType().As().SingleInstance(); 32 | builder.RegisterType().As().SingleInstance(); 33 | 34 | builder.RegisterType().As().SingleInstance(); 35 | builder.RegisterType().As().SingleInstance(); 36 | 37 | builder.RegisterType().As().SingleInstance(); 38 | builder.RegisterType().As().SingleInstance(); 39 | 40 | builder.RegisterType().As().SingleInstance(); 41 | builder.RegisterType().As().SingleInstance(); 42 | 43 | var assembly = System.Reflection.Assembly.GetExecutingAssembly(); 44 | 45 | builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces() 46 | .EnableInterfaceInterceptors(new Castle.DynamicProxy.ProxyGenerationOptions() 47 | { 48 | Selector = new AspectInterceptorSelector() 49 | }).SingleInstance(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Core/CrossCuttingConserns/Caching/Microsoft/MemoryCacheManager.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.IoC; 2 | using Microsoft.Extensions.Caching.Memory; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Text.RegularExpressions; 9 | 10 | namespace Core.CrossCuttingConserns.Caching.Microsoft 11 | { 12 | public class MemoryCacheManager : ICacheManager 13 | { 14 | IMemoryCache _memoryCache; 15 | public MemoryCacheManager() 16 | { 17 | _memoryCache = ServiceTool.ServiceProvider.GetService(); 18 | } 19 | public void Add(string key, object value, int duration) 20 | { 21 | _memoryCache.Set(key, value, TimeSpan.FromMinutes(duration)); 22 | } 23 | 24 | public T Get(string key) 25 | { 26 | return _memoryCache.Get(key); 27 | } 28 | 29 | public object Get(string key) 30 | { 31 | return _memoryCache.Get(key); 32 | } 33 | 34 | public bool IsAdd(string key) 35 | { 36 | return _memoryCache.TryGetValue(key, out _); 37 | } 38 | 39 | public void Remove(string key) 40 | { 41 | _memoryCache.Remove(key); 42 | } 43 | 44 | public void RemovePattern(string pattern) 45 | { 46 | var cacheEntriesCollectionDefinition = typeof(MemoryCache).GetProperty("EntriesCollection", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); 47 | var cacheEntriesCollection = cacheEntriesCollectionDefinition.GetValue(_memoryCache) as dynamic; 48 | List cacheCollectionValues = new List(); 49 | 50 | foreach (var cacheItem in cacheEntriesCollection) 51 | { 52 | ICacheEntry cacheItemValue = cacheItem.GetType().GetProperty("Value").GetValue(cacheItem, null); 53 | cacheCollectionValues.Add(cacheItemValue); 54 | } 55 | 56 | var regex = new Regex(pattern, RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase); 57 | var keysToRemove = cacheCollectionValues.Where(d => regex.IsMatch(d.Key.ToString())).Select(d => d.Key).ToList(); 58 | 59 | foreach (var key in keysToRemove) 60 | { 61 | _memoryCache.Remove(key); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Business/Concrete/CarManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.ValidationRules.FluentValidation; 3 | using Core.Aspects.Autofac.Caching; 4 | using Core.Aspects.Autofac.Performance; 5 | using Core.Aspects.Autofac.Validation; 6 | using Core.CrossCuttingConserns.Validation; 7 | using Core.Utilities.Results; 8 | using DataAccess.Abstract; 9 | using Entities.Concrete; 10 | using Entities.Dtos; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Linq.Expressions; 15 | using System.Text; 16 | 17 | namespace Business.Concrete 18 | { 19 | public class CarManager : ICarService 20 | { 21 | private readonly ICarDal _carDal; 22 | 23 | public CarManager(ICarDal carDal) 24 | { 25 | _carDal = carDal; 26 | } 27 | 28 | [ValidationAspect(typeof(CarValidator))] 29 | public IResult Add(Car entity) 30 | { 31 | //ValidationTool.Validate(new CarValidator(), entity); 32 | _carDal.Add(entity); 33 | return new SuccessResult(); 34 | } 35 | 36 | public IResult Delete(Car entity) 37 | { 38 | var car = _carDal.GetById(entity.Id); 39 | if (car == null) return new ErrorResult(); 40 | _carDal.Delete(car); 41 | return new SuccessResult(); 42 | } 43 | 44 | [CacheAspect] 45 | [PerformanceAspect(3)] 46 | public IDataResult> GetAll(Expression> filter = null) 47 | { 48 | return new SuccessDataResult>(_carDal.GetAll(filter)); 49 | } 50 | 51 | public IDataResult> GetByBrandId(int brandId) 52 | { 53 | return new SuccessDataResult>(_carDal.GetAll(x => x.BrandId == brandId)); 54 | } 55 | 56 | public IDataResult> GetByColorId(int colorId) 57 | { 58 | return new SuccessDataResult>(_carDal.GetAll(x => x.ColorId == colorId)); 59 | } 60 | 61 | [CacheAspect] 62 | public IDataResult GetById(int id) 63 | { 64 | return new SuccessDataResult(_carDal.GetById(id)); 65 | } 66 | 67 | [CacheRemoveAspect("ICarService.Get")] 68 | public IResult Update(Car entity) 69 | { 70 | _carDal.Update(entity); 71 | return new SuccessResult(); 72 | } 73 | 74 | public IDataResult> GetCarDTOs() 75 | { 76 | return new SuccessDataResult>(_carDal.GetCarsDetails()); 77 | } 78 | 79 | public IDataResult GetCarDTO(int id) 80 | { 81 | return new SuccessDataResult(_carDal.GetCarDetailsById(id)); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCarDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using DataAccess.Concrete.EntityFramework.Context; 4 | using Entities.Concrete; 5 | using Entities.Dtos; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | 11 | namespace DataAccess.Concrete.EntityFramework 12 | { 13 | public class EfCarDal : EfEntityRepositoryBase, ICarDal 14 | { 15 | public List GetCarsDetails() 16 | { 17 | using (var context = new ReCapContext()) 18 | { 19 | var cars = from c in context.Cars 20 | join b in context.Brands 21 | on c.BrandId equals b.Id 22 | join cl in context.Colors 23 | on c.ColorId equals cl.Id 24 | select new CarDTO 25 | { 26 | Brand = b.Name, 27 | Color = cl.Name, 28 | DailyPrice = c.DailyPrice, 29 | Description = c.Description, 30 | ModelYear = c.ModelYear 31 | }; 32 | //var carsDto = context.Cars.Select(x => new CarDTO 33 | //{ 34 | // Brand = context.Brands.SingleOrDefault(b => b.Id == x.BrandId).Name, 35 | // Color = context.Colors.SingleOrDefault(cl => cl.Id == x.ColorId).Name, 36 | // DailyPrice = x.DailyPrice, 37 | // Description = x.Description, 38 | // ModelYear = x.ModelYear 39 | //}); 40 | return cars.ToList(); 41 | } 42 | } 43 | public CarDTO GetCarDetailsById(int id) 44 | { 45 | using (var context = new ReCapContext()) 46 | { 47 | var car = from cr in context.Cars 48 | join br in context.Brands 49 | on cr.BrandId equals br.Id 50 | join cl in context.Colors 51 | on cr.ColorId equals cl.Id 52 | where cr.Id == id 53 | select new CarDTO 54 | { 55 | Brand = br.Name, 56 | Color = cl.Name, 57 | DailyPrice = cr.DailyPrice, 58 | Description = cr.Description, 59 | ModelYear = cr.ModelYear 60 | }; 61 | return car.SingleOrDefault(); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Jwt/JwtHelper.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Extensions; 3 | using Core.Utilities.Security.Encryption; 4 | using Microsoft.Extensions.Configuration; 5 | using Microsoft.IdentityModel.Tokens; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IdentityModel.Tokens.Jwt; 9 | using System.Linq; 10 | using System.Security.Claims; 11 | using System.Text; 12 | 13 | namespace Core.Utilities.Security.Jwt 14 | { 15 | public class JwtHelper : ITokenHelper 16 | { 17 | public IConfiguration Configuration { get; } 18 | private TokenOptions _tokenOptions; 19 | DateTime _accessTokenExpiration; 20 | public JwtHelper(IConfiguration configuration) 21 | { 22 | Configuration = configuration; 23 | _tokenOptions = Configuration.GetSection("TokenOptions").Get(); 24 | _accessTokenExpiration = DateTime.Now.AddMinutes(_tokenOptions.AccessTokenExpiration); 25 | } 26 | public AccessToken CreateToken(User user, List operationClaims) 27 | { 28 | var securityKey = SecurityKeyHelper.CreateSecurityKey(_tokenOptions.SecurityKey); 29 | var signingCredentials = SigningCredentialsHelper.CreateSigningCredentials(securityKey); 30 | var jwt = CreateJwtSecurityToken(_tokenOptions, user, signingCredentials, operationClaims); 31 | var jwtSercurityTokenHandler = new JwtSecurityTokenHandler(); 32 | var token = jwtSercurityTokenHandler.WriteToken(jwt); 33 | 34 | return new AccessToken 35 | { 36 | Token = token, 37 | Expiration = _accessTokenExpiration 38 | }; 39 | } 40 | public JwtSecurityToken CreateJwtSecurityToken(TokenOptions tokenOptions, User user, SigningCredentials signingCredentials, List operationClaims) 41 | { 42 | var jwt = new JwtSecurityToken( 43 | issuer: _tokenOptions.Issuer, 44 | audience: _tokenOptions.Audience, 45 | expires: _accessTokenExpiration, 46 | notBefore: DateTime.Now, 47 | claims: SetClaims(user, operationClaims), 48 | signingCredentials: signingCredentials); 49 | return jwt; 50 | } 51 | 52 | private IEnumerable SetClaims(User user, List operationClaims) 53 | { 54 | var claims = new List(); 55 | claims.AddNameIdentifier(user.Id.ToString()); 56 | claims.AddMail(user.EMail); 57 | claims.AddName($"{user.FirstName} {user.LastName}"); 58 | claims.AddRoles(operationClaims.Select(c => c.Name).ToArray()); 59 | return claims; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Business/Concrete/AuthManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Core.Entities.Concrete; 4 | using Core.Utilities.Results; 5 | using Core.Utilities.Security.Hashing; 6 | using Core.Utilities.Security.Jwt; 7 | using Entities.Dtos; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | 12 | namespace Business.Concrete 13 | { 14 | public class AuthManager : IAuthService 15 | { 16 | private readonly IUserService _userService; 17 | private readonly ITokenHelper _tokenHelper; 18 | 19 | public AuthManager(IUserService userService, ITokenHelper tokenHelper) 20 | { 21 | _userService = userService; 22 | _tokenHelper = tokenHelper; 23 | } 24 | 25 | public IDataResult CreateAccessToken(User user) 26 | { 27 | var claims = _userService.GetClaims(user); 28 | var accessToken = _tokenHelper.CreateToken(user, claims.Data); 29 | return new SuccessDataResult(accessToken, Messages.AccessTokenCreated); 30 | } 31 | 32 | public IDataResult Login(UserForLoginDto userForLoginDto) 33 | { 34 | var userToCheck = _userService.GetByEMail(userForLoginDto.EMail); 35 | if (userToCheck.Data == null) 36 | { 37 | return new ErrorDataResult(Messages.UserNotFound); 38 | } 39 | 40 | if (!HashingHelper.VerifyPasswordhash(userForLoginDto.Password, userToCheck.Data.PasswordHash, userToCheck.Data.PasswordSalt)) 41 | { 42 | return new ErrorDataResult(Messages.PasswordError); 43 | } 44 | return new SuccessDataResult(userToCheck.Data, Messages.SuccessfullLogin); 45 | } 46 | 47 | public IDataResult Register(UserForRegisterDto userForRegisterDto) 48 | { 49 | byte[] passwordHash, passwordSalt; 50 | HashingHelper.CreatePasswordHash(userForRegisterDto.Password, out passwordHash, out passwordSalt); 51 | var user = new User 52 | { 53 | EMail = userForRegisterDto.EMail, 54 | FirstName = userForRegisterDto.FirstName, 55 | LastName = userForRegisterDto.LastName, 56 | PasswordHash = passwordHash, 57 | PasswordSalt = passwordSalt, 58 | Status = true 59 | }; 60 | _userService.Add(user); 61 | return new SuccessDataResult(user, Messages.UserRegistered); 62 | } 63 | 64 | public IResult UserExists(string email) 65 | { 66 | if (_userService.GetByEMail(email).Data!=null) 67 | { 68 | return new ErrorResult(Messages.UserAlreadyExists); 69 | } 70 | return new SuccessResult(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /DataAccess/Concrete/InMemory/MemCarDal.cs: -------------------------------------------------------------------------------- 1 | using DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using Entities.Dtos; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Linq.Expressions; 8 | using System.Text; 9 | 10 | namespace DataAccess.Concrete.InMemory 11 | { 12 | public class MemCarDal : ICarDal 13 | { 14 | private List _cars; 15 | public MemCarDal() 16 | { 17 | _cars = new List 18 | { 19 | new Car{Id = 1, BrandId = 1, ColorId = 3, DailyPrice= 450, ModelYear=2017, Description="Klima, Dokunmatik Media Sistemi"}, 20 | new Car{Id = 2, BrandId = 2, ColorId = 3, DailyPrice= 500, ModelYear=2018, Description="Klima, Dokunmatik Media Sistemi"}, 21 | new Car{Id = 3, BrandId = 2, ColorId = 1, DailyPrice= 700, ModelYear=2018, Description="Klima, Dokunmatik Media Sistemi"}, 22 | new Car{Id = 4, BrandId = 3, ColorId = 1, DailyPrice= 1250, ModelYear=2020, Description="Klima, Dokunmatik Media Sistemi"}, 23 | new Car{Id = 5, BrandId = 3, ColorId = 2, DailyPrice= 1200, ModelYear=2020, Description="Klima, Dokunmatik Media Sistemi"}, 24 | }; 25 | } 26 | public void Add(Car entity) 27 | { 28 | entity.Id = _cars.Max(x => x.Id) + 1; // cars nesnesindeki Id numaraları tek artımlı olarak yaratan code satırı. 29 | _cars.Add(entity); 30 | } 31 | 32 | public void Delete(Car entity) 33 | { 34 | _cars.Remove(entity); 35 | } 36 | 37 | public Car Get(Expression> filter) 38 | { 39 | return _cars.SingleOrDefault(filter.Compile()); 40 | } 41 | 42 | public List GetAll(Expression> filter = null) 43 | { 44 | return filter == null ? _cars : _cars.Where(filter.Compile()).ToList(); //metod parametresinde filtre gelip gelmediğini kontrol eden Ternary (tek satır if) koşulu 45 | } 46 | 47 | public Car GetById(int id) 48 | { 49 | return _cars.SingleOrDefault(c => c.Id == id); 50 | } 51 | 52 | public CarDTO GetCarDetailsById(int id) 53 | { 54 | throw new NotImplementedException(); 55 | } 56 | 57 | public List GetCarsDetails() 58 | { 59 | throw new NotImplementedException(); 60 | } 61 | 62 | public void Update(Car entity) 63 | { 64 | var car = _cars.SingleOrDefault(c => c.Id == entity.Id); 65 | if (car == null) throw new NullReferenceException("Güncellenecek araç bulunamadı!"); 66 | car.BrandId = entity.BrandId; 67 | car.ColorId = entity.ColorId; 68 | car.DailyPrice = entity.DailyPrice; 69 | car.ModelYear = entity.ModelYear; 70 | car.Description = entity.Description; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class CarsController : ControllerBase 15 | { 16 | ICarService _carService; 17 | 18 | public CarsController(ICarService carService) 19 | { 20 | _carService = carService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult Get() 25 | { 26 | var result = _carService.GetAll(); 27 | if (result.Success) 28 | return Ok(result); 29 | return BadRequest(result); 30 | } 31 | 32 | [HttpGet("getbyid")] 33 | public IActionResult Get(int id) 34 | { 35 | var result = _carService.GetById(id); 36 | if (result.Success) 37 | return Ok(result); 38 | return BadRequest(result); 39 | } 40 | 41 | [HttpGet("getbycolorid")] 42 | public IActionResult GetByColorId(int id) 43 | { 44 | var result = _carService.GetByColorId(id); 45 | if (result.Success) 46 | return Ok(result); 47 | return BadRequest(result); 48 | } 49 | 50 | [HttpGet("getbybrandid")] 51 | public IActionResult GetByBrandId(int id) 52 | { 53 | var result = _carService.GetByBrandId(id); 54 | if (result.Success) 55 | return Ok(result); 56 | return BadRequest(result); 57 | } 58 | 59 | [HttpGet("getcardetail")] 60 | public IActionResult GetCarDTO(int id) 61 | { 62 | var result = _carService.GetCarDTO(id); 63 | if (result.Success) 64 | return Ok(result); 65 | return BadRequest(result); 66 | } 67 | 68 | [HttpGet("getcarsdetail")] 69 | public IActionResult GetCarsDTO() 70 | { 71 | var result = _carService.GetCarDTOs(); 72 | if (result.Success) 73 | return Ok(result); 74 | return BadRequest(result); 75 | } 76 | 77 | [HttpPost("add")] 78 | public IActionResult Post(Car car) 79 | { 80 | var result = _carService.Add(car); 81 | if (result.Success) 82 | return Ok(result); 83 | return BadRequest(result); 84 | } 85 | 86 | [HttpPost("update")] 87 | public IActionResult PostUpdate(Car car) 88 | { 89 | var result = _carService.Update(car); 90 | if (result.Success) 91 | return Ok(result); 92 | return BadRequest(result); 93 | } 94 | 95 | [HttpPost("delete")] 96 | public IActionResult PostDelete(Car car) 97 | { 98 | var result = _carService.Delete(car); 99 | if (result.Success) 100 | return Ok(result); 101 | return BadRequest(result); 102 | } 103 | 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarImagesController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Hosting; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.AspNetCore.Mvc; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IO; 9 | using System.Linq; 10 | using System.Threading.Tasks; 11 | using WebAPI.Utilities; 12 | 13 | namespace WebAPI.Controllers 14 | { 15 | [Route("api/[controller]")] 16 | [ApiController] 17 | public class CarImagesController : ControllerBase 18 | { 19 | private readonly ICarImageService _carImageService; 20 | private readonly IWebHostEnvironment _webHostEnv; 21 | public string DefaultImagePath { get; } 22 | 23 | public CarImagesController(ICarImageService carImageService, IWebHostEnvironment webHostEnv) 24 | { 25 | _carImageService = carImageService; 26 | _webHostEnv = webHostEnv; 27 | DefaultImagePath = Path.Combine(_webHostEnv.WebRootPath, @"Upload"); 28 | } 29 | 30 | [HttpPost("add")] 31 | public IActionResult Post([FromForm(Name = ("file"))] IFormFile file, [FromForm] CarImage carImage) 32 | { 33 | var check = CheckFormValues(file, carImage); 34 | if (check != null) return BadRequest(check); 35 | 36 | var imagePath = ImageUploader.ImageUpload(DefaultImagePath, file); 37 | 38 | carImage.ImagePath = imagePath.Result; 39 | 40 | var result = _carImageService.Add(carImage); 41 | if (result.Success) 42 | return Ok(result); 43 | return BadRequest(result); 44 | } 45 | 46 | [HttpPost("update")] 47 | public IActionResult Update([FromForm(Name = "file")] IFormFile file, [FromForm] CarImage carImage) 48 | { 49 | var check = CheckFormValues(file, carImage); 50 | if (check != null) return BadRequest(check); 51 | 52 | var imagePath = ImageUploader.ImageUpload(DefaultImagePath, file); 53 | ImageUploader.ImageDelete(Path.Combine(DefaultImagePath, carImage.ImagePath)); 54 | 55 | carImage.ImagePath = imagePath.Result; 56 | 57 | var result = _carImageService.Update(carImage); 58 | if (result.Success) 59 | return Ok(result); 60 | return BadRequest(result); 61 | } 62 | 63 | [HttpPost("remove")] 64 | public IActionResult Post(CarImage carImage) 65 | { 66 | ImageUploader.ImageDelete(Path.Combine(DefaultImagePath, carImage.ImagePath)); 67 | var result = _carImageService.Delete(carImage); 68 | if (result.Success) return Ok(result); 69 | return BadRequest(result); 70 | } 71 | 72 | private string CheckFormValues(IFormFile file, CarImage carImage) 73 | { 74 | if (file == null || file.Length <= 0) 75 | return "Dosya seçmediniz"; 76 | 77 | if (carImage.CarId == 0) 78 | return "Araç seçmediniz"; 79 | 80 | var fileExtension = Path.GetExtension(file.FileName); 81 | if (!(fileExtension.ToLower() == ".jpg" || fileExtension.ToLower() == ".png")) 82 | return @"Seçilen dosya uygun değil! '*.jpg' || '*.png'"; 83 | 84 | return null; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /ReCapProject.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30907.101 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Entities", "Entities\Entities.csproj", "{80BCAE19-4A8B-49D8-9BB7-5F6D59152B24}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataAccess", "DataAccess\DataAccess.csproj", "{A0805EC0-956D-4B3A-86CB-7B07EF1ECE45}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Business", "Business\Business.csproj", "{95B9F766-AE48-4ACE-9B6B-1DEF0605F27B}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleUI", "ConsoleUI\ConsoleUI.csproj", "{EA2089A8-E1E4-4CDB-8F01-9E7F94DCC148}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{713FB3DB-9442-48D3-A66B-1A2FADFCB930}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPI", "WebAPI\WebAPI.csproj", "{C4E72F1E-6AF1-4216-8E3B-9AA3A9400604}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Release|Any CPU = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {80BCAE19-4A8B-49D8-9BB7-5F6D59152B24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {80BCAE19-4A8B-49D8-9BB7-5F6D59152B24}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {80BCAE19-4A8B-49D8-9BB7-5F6D59152B24}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {80BCAE19-4A8B-49D8-9BB7-5F6D59152B24}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {A0805EC0-956D-4B3A-86CB-7B07EF1ECE45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {A0805EC0-956D-4B3A-86CB-7B07EF1ECE45}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {A0805EC0-956D-4B3A-86CB-7B07EF1ECE45}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {A0805EC0-956D-4B3A-86CB-7B07EF1ECE45}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {95B9F766-AE48-4ACE-9B6B-1DEF0605F27B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {95B9F766-AE48-4ACE-9B6B-1DEF0605F27B}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {95B9F766-AE48-4ACE-9B6B-1DEF0605F27B}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {95B9F766-AE48-4ACE-9B6B-1DEF0605F27B}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {EA2089A8-E1E4-4CDB-8F01-9E7F94DCC148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {EA2089A8-E1E4-4CDB-8F01-9E7F94DCC148}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {EA2089A8-E1E4-4CDB-8F01-9E7F94DCC148}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {EA2089A8-E1E4-4CDB-8F01-9E7F94DCC148}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {713FB3DB-9442-48D3-A66B-1A2FADFCB930}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {713FB3DB-9442-48D3-A66B-1A2FADFCB930}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {713FB3DB-9442-48D3-A66B-1A2FADFCB930}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {713FB3DB-9442-48D3-A66B-1A2FADFCB930}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {C4E72F1E-6AF1-4216-8E3B-9AA3A9400604}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {C4E72F1E-6AF1-4216-8E3B-9AA3A9400604}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {C4E72F1E-6AF1-4216-8E3B-9AA3A9400604}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {C4E72F1E-6AF1-4216-8E3B-9AA3A9400604}.Release|Any CPU.Build.0 = Release|Any CPU 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | GlobalSection(ExtensibilityGlobals) = postSolution 53 | SolutionGuid = {99CC1D57-75EE-4FD2-9838-609FC7FABDAB} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /WebAPI/Startup.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Concrete; 3 | using Core.DependencyResolvers; 4 | using Core.Utilities.Extensions; 5 | using Core.Utilities.IoC; 6 | using Core.Utilities.Security.Encryption; 7 | using Core.Utilities.Security.Jwt; 8 | using DataAccess.Abstract; 9 | using DataAccess.Concrete.EntityFramework; 10 | using Microsoft.AspNetCore.Authentication.JwtBearer; 11 | using Microsoft.AspNetCore.Builder; 12 | using Microsoft.AspNetCore.Hosting; 13 | using Microsoft.AspNetCore.Http; 14 | using Microsoft.AspNetCore.HttpsPolicy; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.Extensions.Configuration; 17 | using Microsoft.Extensions.DependencyInjection; 18 | using Microsoft.Extensions.Hosting; 19 | using Microsoft.Extensions.Logging; 20 | using Microsoft.OpenApi.Models; 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Threading.Tasks; 25 | 26 | namespace WebAPI 27 | { 28 | public class Startup 29 | { 30 | public Startup(IConfiguration configuration) 31 | { 32 | Configuration = configuration; 33 | } 34 | 35 | public IConfiguration Configuration { get; } 36 | 37 | // This method gets called by the runtime. Use this method to add services to the container. 38 | public void ConfigureServices(IServiceCollection services) 39 | { 40 | services.AddControllers(); 41 | 42 | services.AddCors(options => 43 | { 44 | options.AddPolicy("AllowOrigin", 45 | builder => builder.WithOrigins("http://localhost:4200")); 46 | }); 47 | 48 | var tokenOptions = Configuration.GetSection("TokenOptions").Get(); 49 | services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options => 50 | { 51 | options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters 52 | { 53 | ValidateIssuer = true, 54 | ValidateAudience = true, 55 | ValidateLifetime = true, 56 | ValidIssuer = tokenOptions.Issuer, 57 | ValidateIssuerSigningKey = true, 58 | IssuerSigningKey = SecurityKeyHelper.CreateSecurityKey(tokenOptions.SecurityKey) 59 | }; 60 | }); 61 | 62 | services.AddDependencyResolvers(new ICoreModule[] 63 | { 64 | new CoreModule(), 65 | }); 66 | 67 | services.AddSwaggerGen(c => 68 | { 69 | c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" }); 70 | }); 71 | } 72 | 73 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 74 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 75 | { 76 | if (env.IsDevelopment()) 77 | { 78 | app.UseDeveloperExceptionPage(); 79 | app.UseSwagger(); 80 | app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI v1")); 81 | } 82 | 83 | app.UseCors(builder => builder.WithOrigins("http://localhost:4200").AllowAnyHeader()); 84 | 85 | app.UseHttpsRedirection(); 86 | 87 | app.UseRouting(); 88 | 89 | app.UseAuthorization(); 90 | 91 | app.UseAuthentication(); 92 | 93 | app.UseStaticFiles(); 94 | 95 | app.UseEndpoints(endpoints => 96 | { 97 | endpoints.MapControllers(); 98 | }); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "align": { 8 | "options": [ 9 | "parameters", 10 | "statements" 11 | ] 12 | }, 13 | "array-type": false, 14 | "arrow-return-shorthand": true, 15 | "curly": true, 16 | "deprecation": { 17 | "severity": "warning" 18 | }, 19 | "eofline": true, 20 | "import-blacklist": [ 21 | true, 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": { 26 | "options": [ 27 | "spaces" 28 | ] 29 | }, 30 | "max-classes-per-file": false, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-console": [ 47 | true, 48 | "debug", 49 | "info", 50 | "time", 51 | "timeEnd", 52 | "trace" 53 | ], 54 | "no-empty": false, 55 | "no-inferrable-types": [ 56 | true, 57 | "ignore-params" 58 | ], 59 | "no-non-null-assertion": true, 60 | "no-redundant-jsdoc": true, 61 | "no-switch-case-fall-through": true, 62 | "no-var-requires": false, 63 | "object-literal-key-quotes": [ 64 | true, 65 | "as-needed" 66 | ], 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "semicolon": { 72 | "options": [ 73 | "always" 74 | ] 75 | }, 76 | "space-before-function-paren": { 77 | "options": { 78 | "anonymous": "never", 79 | "asyncArrow": "always", 80 | "constructor": "never", 81 | "method": "never", 82 | "named": "never" 83 | } 84 | }, 85 | "typedef": [ 86 | true, 87 | "call-signature" 88 | ], 89 | "typedef-whitespace": { 90 | "options": [ 91 | { 92 | "call-signature": "nospace", 93 | "index-signature": "nospace", 94 | "parameter": "nospace", 95 | "property-declaration": "nospace", 96 | "variable-declaration": "nospace" 97 | }, 98 | { 99 | "call-signature": "onespace", 100 | "index-signature": "onespace", 101 | "parameter": "onespace", 102 | "property-declaration": "onespace", 103 | "variable-declaration": "onespace" 104 | } 105 | ] 106 | }, 107 | "variable-name": { 108 | "options": [ 109 | "ban-keywords", 110 | "check-format", 111 | "allow-pascal-case" 112 | ] 113 | }, 114 | "whitespace": { 115 | "options": [ 116 | "check-branch", 117 | "check-decl", 118 | "check-operator", 119 | "check-separator", 120 | "check-type", 121 | "check-typecast" 122 | ] 123 | }, 124 | "component-class-suffix": true, 125 | "contextual-lifecycle": true, 126 | "directive-class-suffix": true, 127 | "no-conflicting-lifecycle": true, 128 | "no-host-metadata-property": true, 129 | "no-input-rename": true, 130 | "no-inputs-metadata-property": true, 131 | "no-output-native": true, 132 | "no-output-on-prefix": true, 133 | "no-output-rename": true, 134 | "no-outputs-metadata-property": true, 135 | "template-banana-in-box": true, 136 | "template-no-negated-async": true, 137 | "use-lifecycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "directive-selector": [ 140 | true, 141 | "attribute", 142 | "app", 143 | "camelCase" 144 | ], 145 | "component-selector": [ 146 | true, 147 | "element", 148 | "app", 149 | "kebab-case" 150 | ] 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /AngularUI/ReCapAngularUI/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "cli": { 4 | "analytics": "239926eb-ca42-4415-b135-102134fcdede" 5 | }, 6 | "version": 1, 7 | "newProjectRoot": "projects", 8 | "projects": { 9 | "ReCapAngularUI": { 10 | "projectType": "application", 11 | "schematics": { 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "@angular-devkit/build-angular:browser", 22 | "options": { 23 | "outputPath": "dist/ReCapAngularUI", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "aot": true, 29 | "assets": [ 30 | "src/favicon.ico", 31 | "src/assets" 32 | ], 33 | "styles": [ 34 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", 35 | "src/styles.css" 36 | ], 37 | "scripts": [ 38 | "./node_modules/jquery/dist/jquery.min.js", 39 | "./node_modules/bootstrap/dist/js/bootstrap.min.js" 40 | ] 41 | }, 42 | "configurations": { 43 | "production": { 44 | "fileReplacements": [ 45 | { 46 | "replace": "src/environments/environment.ts", 47 | "with": "src/environments/environment.prod.ts" 48 | } 49 | ], 50 | "optimization": true, 51 | "outputHashing": "all", 52 | "sourceMap": false, 53 | "namedChunks": false, 54 | "extractLicenses": true, 55 | "vendorChunk": false, 56 | "buildOptimizer": true, 57 | "budgets": [ 58 | { 59 | "type": "initial", 60 | "maximumWarning": "500kb", 61 | "maximumError": "1mb" 62 | }, 63 | { 64 | "type": "anyComponentStyle", 65 | "maximumWarning": "2kb", 66 | "maximumError": "4kb" 67 | } 68 | ] 69 | } 70 | } 71 | }, 72 | "serve": { 73 | "builder": "@angular-devkit/build-angular:dev-server", 74 | "options": { 75 | "browserTarget": "ReCapAngularUI:build" 76 | }, 77 | "configurations": { 78 | "production": { 79 | "browserTarget": "ReCapAngularUI:build:production" 80 | } 81 | } 82 | }, 83 | "extract-i18n": { 84 | "builder": "@angular-devkit/build-angular:extract-i18n", 85 | "options": { 86 | "browserTarget": "ReCapAngularUI:build" 87 | } 88 | }, 89 | "test": { 90 | "builder": "@angular-devkit/build-angular:karma", 91 | "options": { 92 | "main": "src/test.ts", 93 | "polyfills": "src/polyfills.ts", 94 | "tsConfig": "tsconfig.spec.json", 95 | "karmaConfig": "karma.conf.js", 96 | "assets": [ 97 | "src/favicon.ico", 98 | "src/assets" 99 | ], 100 | "styles": [ 101 | "src/styles.css" 102 | ], 103 | "scripts": [] 104 | } 105 | }, 106 | "lint": { 107 | "builder": "@angular-devkit/build-angular:tslint", 108 | "options": { 109 | "tsConfig": [ 110 | "tsconfig.app.json", 111 | "tsconfig.spec.json", 112 | "e2e/tsconfig.json" 113 | ], 114 | "exclude": [ 115 | "**/node_modules/**" 116 | ] 117 | } 118 | }, 119 | "e2e": { 120 | "builder": "@angular-devkit/build-angular:protractor", 121 | "options": { 122 | "protractorConfig": "e2e/protractor.conf.js", 123 | "devServerTarget": "ReCapAngularUI:serve" 124 | }, 125 | "configurations": { 126 | "production": { 127 | "devServerTarget": "ReCapAngularUI:serve:production" 128 | } 129 | } 130 | } 131 | } 132 | } 133 | }, 134 | "defaultProject": "ReCapAngularUI" 135 | } 136 | -------------------------------------------------------------------------------- /ConsoleUI/Program.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.DependencySolvers; 3 | using Core.Entities.Concrete; 4 | using Entities.Concrete; 5 | using Entities.Dtos; 6 | using FluentValidation; 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | namespace ConsoleUI 11 | { 12 | class Program 13 | { 14 | private static ICarService _carService; 15 | private static IBrandService _brandService; 16 | private static IColorService _colorService; 17 | private static IUserService _userService; 18 | private static ICustomerService _customerService; 19 | private static IRentalService _rentalService; 20 | static void Main(string[] args) 21 | { 22 | // Business katmanındaki Ninject dependency solver instance factory metodu 23 | _carService = InstanceFactory.GetInstance(); 24 | _colorService = InstanceFactory.GetInstance(); 25 | _brandService = InstanceFactory.GetInstance(); 26 | _userService = InstanceFactory.GetInstance(); 27 | _customerService = InstanceFactory.GetInstance(); 28 | _rentalService = InstanceFactory.GetInstance(); 29 | //SekizinciGunTest(); 30 | 31 | //WriteTheCars(_carService.GetCarDTOs()); // UI metodu 32 | 33 | //var allSkodas = _carService.GetCarDTOs().Where(x => x.Brand == "Skoda").ToList(); 34 | //WriteTheCars(allSkodas); 35 | 36 | //WriteCar(_carService.GetCarDTO(6)); // Id değerine göre tablodan değer getiren sorgu 37 | 38 | //WriteTheCars(_carService.GetCarDTOs()); 39 | 40 | //Task10_1(); 41 | 42 | //CreateUserAndCustomer(); 43 | 44 | //RentCar(); 45 | 46 | //ReturnCar(); 47 | } 48 | 49 | private static void ReturnCar() 50 | { 51 | var carsAtCustomer = _rentalService.GetAll(x => x.CustomerId == 1 && x.ReturnDate == null); 52 | foreach (var car in carsAtCustomer.Data) 53 | { 54 | if (car.CarId == 7) 55 | { 56 | car.ReturnDate = DateTime.Now; 57 | _rentalService.Update(car); 58 | } 59 | } 60 | } 61 | 62 | private static void RentCar() 63 | { 64 | Console.WriteLine(_rentalService.Add(new Rental { CarId = 7, CustomerId = 1, RentDate = DateTime.Now.Date }).Message); 65 | } 66 | 67 | private static void CreateUserAndCustomer() 68 | { 69 | //Console.WriteLine(_userService.Add(new User { FirstName = "İbrahim", LastName = "Doğuş", EMail = "idogus@gmail.com", PasswordHash = "1234" }).Message); 70 | Console.WriteLine(_customerService.Add(new Customer { UserId = 1, CompanyName = "Doğuş Yazılım" }).Message); 71 | } 72 | 73 | private static void Task10_1() 74 | { 75 | Console.WriteLine(_brandService.Add(new Brand { Name = "Vişne Çürüğü" }).Message); 76 | } 77 | 78 | private static void SekizinciGunTest() 79 | { 80 | // 8. Gün ödevi testi 81 | Brand ford = new Brand { Name = "Ford" }; 82 | Brand a = new Brand { Name = "A" }; 83 | Color balKopugu = new Color { Name = "Bal Köpüğü" }; 84 | Car car = new Car { Description = "Otomatik klima, Otomatik vites", DailyPrice = 1200, ModelYear = 2021, BrandId = 2, ColorId = 2 }; 85 | 86 | try 87 | { 88 | _colorService.Add(balKopugu); 89 | _brandService.Add(ford); 90 | _brandService.Add(a); 91 | } 92 | catch (ValidationException ex) 93 | { 94 | var msg = ex.Message.Split(':')[ex.Message.Split(':').Length - 1]; 95 | Console.WriteLine(msg); ; 96 | } 97 | 98 | try 99 | { 100 | _carService.Add(car); 101 | } 102 | catch (ValidationException ex) 103 | { 104 | var msg = ex.Message.Split(':')[ex.Message.Split(':').Length - 1]; 105 | Console.WriteLine(msg); ; 106 | } 107 | } 108 | 109 | // Araç listesini yazdıran metod 110 | private static void WriteTheCars(IList cars) 111 | { 112 | Console.WriteLine("=============== Araç Listesi ================"); 113 | 114 | foreach (var car in cars) 115 | { 116 | Console.WriteLine($"{car.Brand} \t{car.Color} \t{car.ModelYear} \t{car.DailyPrice.ToString("#,###.00")} \t{car.Description}"); 117 | } 118 | } 119 | // Tek aracı yazdıran metod 120 | private static void WriteCar(CarDTO car) 121 | { 122 | if (car != null) 123 | { 124 | Console.WriteLine("============ Seçilen Araç ================"); 125 | Console.WriteLine($"{car.Brand} marka \n{ car.Color} renkli \n{car.Description} özelliklerine sahip \n{car.ModelYear} model araç günlüğü \n{car.DailyPrice.ToString("#,###.00")} TL"); 126 | } 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb --------------------------------------------------------------------------------