├── .gitattributes ├── .gitignore ├── Business ├── Abstract │ ├── IAuthService.cs │ ├── IBrandService.cs │ ├── ICarImageService.cs │ ├── ICarService.cs │ ├── IColorService.cs │ ├── ICustomerService.cs │ ├── IPaymentService.cs │ ├── IRentalService.cs │ └── IUserService.cs ├── Business.csproj ├── BusinessAspects │ └── Autofac │ │ └── SecuredOperation.cs ├── Concrate │ ├── AuthManager.cs │ ├── BrandManager.cs │ ├── CarImageManager.cs │ ├── CarManager.cs │ ├── ColorManager.cs │ ├── CustomerManager.cs │ ├── PaymentManager.cs │ ├── RentalManager.cs │ └── UserManager.cs ├── Constants │ └── Messages.cs ├── DependencyResolvers │ └── Autofac │ │ └── AutofacBusinessModule.cs └── ValidationRules │ └── FluentValidation │ └── CarValidator.cs ├── ConsoleUI ├── ConsoleUI.csproj └── Program.cs ├── Core ├── Aspects │ └── Autofac │ │ ├── Caching │ │ ├── CacheAspect.cs │ │ └── CacheRemoveAspect.cs │ │ ├── Exception │ │ └── ExceptionLogAspect.cs │ │ ├── Logging │ │ └── LogAspect.cs │ │ ├── Performance │ │ └── PerformanceAspect.cs │ │ ├── Transaction │ │ └── TransactionScopeAspect.cs │ │ └── Validation │ │ └── ValidationAspect.cs ├── Core.csproj ├── CrossCuttingConcerns │ ├── Caching │ │ ├── ICacheManager.cs │ │ └── Microsoft │ │ │ └── MemoryCacheManager.cs │ ├── Logging │ │ ├── Log4Net │ │ │ ├── Layouts │ │ │ │ └── JsonLayout.cs │ │ │ ├── LoggerServiceBase.cs │ │ │ ├── Loggers │ │ │ │ ├── DatabaseLogger.cs │ │ │ │ └── FileLogger.cs │ │ │ └── SerializableLogEvent.cs │ │ ├── LogDetail.cs │ │ ├── LogDetailWithException.cs │ │ └── LogParameter.cs │ └── Validation │ │ └── ValidationTool.cs ├── DataAccess │ ├── EntityFramework │ │ └── EfEntityRepositoryBase.cs │ └── IEntityRepository.cs ├── DependencyResolvers │ └── CoreModule.cs ├── Entities │ ├── Concrete │ │ ├── OperationClaim.cs │ │ ├── Payment │ │ │ ├── FakeCreditCardModel.cs │ │ │ └── IPaymentModel.cs │ │ ├── User.cs │ │ └── UserOperationClaim.cs │ ├── IDto.cs │ └── IEntity.cs ├── Extensions │ ├── ClaimExtensions.cs │ ├── ClaimsPrincipalExtensions.cs │ ├── ErrorDetails.cs │ ├── ExceptionMiddleware.cs │ ├── ExceptionMiddlewareExtensions.cs │ └── ServiceCollectionExtensions.cs └── Utilities │ ├── Business │ └── BusinessRules.cs │ ├── Interceptors │ ├── AspectInterceptorSelector.cs │ ├── MethodInterception.cs │ └── MethodInterceptionBaseAttribute.cs │ ├── IoC │ ├── ICoreModule.cs │ └── ServiceTool.cs │ ├── Messages │ └── AspectMessages.cs │ ├── Operations │ └── FileOperation.cs │ ├── Results │ ├── DataResult.cs │ ├── ErrorDataResult.cs │ ├── ErrorResult.cs │ ├── IDataResult.cs │ ├── IResult.cs │ ├── Result.cs │ ├── SuccessDataResult.cs │ └── SuccessResult.cs │ └── Security │ ├── Encryption │ ├── SecurityKeyHelper.cs │ └── SigningCredentialsHelper.cs │ ├── Hashing │ └── HashingHelper.cs │ └── JWT │ ├── AccessToken.cs │ ├── ITokenHelper.cs │ ├── JwtHelper.cs │ └── TokenOptions.cs ├── DataAccess ├── Abstract │ ├── IBrandDal.cs │ ├── ICarDal.cs │ ├── ICarImageDal.cs │ ├── IColorDal.cs │ ├── ICustomerDal.cs │ ├── IRentalDal.cs │ └── IUserDal.cs ├── Concrate │ ├── EntityFramework │ │ ├── EfBrandDal.cs │ │ ├── EfCarDal.cs │ │ ├── EfCarImageDal.cs │ │ ├── EfColorDal.cs │ │ ├── EfCustomerDal.cs │ │ ├── EfRentalDal.cs │ │ ├── EfUserDal.cs │ │ └── RentACarContext.cs │ └── InMemory │ │ └── InMemoryCarDal.cs └── DataAccess.csproj ├── Entities ├── Concrete │ ├── Brand.cs │ ├── Car.cs │ ├── CarImage.cs │ ├── CardInfo.cs │ ├── Color.cs │ ├── Customer.cs │ ├── Findeks.cs │ ├── Rental.cs │ └── User2.cs ├── DTOs │ ├── CarDetailDto.cs │ ├── CarImageDetailDto.cs │ ├── CustomerDetailDto.cs │ ├── RentalDetailDto.cs │ ├── RentalPaymentDto.cs │ ├── UserForLoginDto.cs │ ├── UserForRegisterDto.cs │ └── UserForUpdateDto.cs └── Entities.csproj ├── LICENSE ├── README.md ├── ReCapProject.sln └── WebAPI ├── Controllers ├── AuthController.cs ├── BrandsController.cs ├── CarImagesController.cs ├── CarsController.cs ├── ColorsController.cs ├── CustomersController.cs ├── RentalsController.cs ├── UsersController.cs └── WeatherForecastController.cs ├── Program.cs ├── Properties └── launchSettings.json ├── Startup.cs ├── WeatherForecast.cs ├── WebAPI.csproj ├── appsettings.Development.json ├── appsettings.json ├── log4net.config └── wwwroot └── Images ├── 02597379-3b78-4887-af14-2fb9ebafd91a.jpg ├── 149e9802-d9b8-46e3-bff5-38b22ee8f539.jpg ├── 164626d8-18fc-40d0-b048-16d4a33c178e.jpg ├── 1950484a-3886-4296-af9a-045799839398.jpg ├── 1f0c625e-1b35-40d2-8521-6c076adec5ea.jpg ├── 25c8128d-e515-42c2-83d5-cc3797f12a92.jpg ├── 2a3c31d0-06bd-40cf-9a84-c01618d1626b.jpg ├── 2d0f31aa-fe3d-4c4c-af6c-b58c2cdd107c.jpg ├── 2df18095-4a34-4ce4-a2d4-86790a75a234.jpg ├── 4736093d-2e53-4c08-8b03-506f151bf528.jpg ├── 47aa0e1c-3f8b-4c57-a4f9-440566becfb7.jpg ├── 4aecfb75-50ef-4ab1-b031-298792fbe9f2.jpg ├── 57277708-91c4-45ba-b32d-1d869ae90ac7.jpg ├── 5b0f5cbb-fe2e-4640-9b1e-5a249fa183a1.jpg ├── 5d34efa8-afd1-4c0a-856e-8882d7cee7da.jpg ├── 67106cb2-18ec-4a6c-aa41-637793baa541.jpg ├── 716207b1-c7e8-4981-9cdf-ac54f06b1fb3.jpg ├── 71d1a806-f674-46e8-a99a-e28bb67102fd.jpeg ├── 7bb9df9a-91a8-4c40-9770-242822abd251.jpg ├── 7ee3971e-d145-4658-a7b3-dc81e239e2f8.jpg ├── 88bae036-10d2-4f89-82e7-a799f5eade3e.jpg ├── 8a75b29f-4b65-42ef-ab4c-61dc7eb55d66.jpg ├── 8ba2e167-f02f-4767-b6ce-ede7b6e55dcd.jpg ├── 8e78f9ce-22af-4138-aad9-add4a37d7949.jpg ├── 95d37396-1f12-4ef5-a837-8555acc2af14.jpg ├── 96299137-090f-46a7-b0dc-a5225d0219d5.jpg ├── 9874f148-cf75-4143-b5f4-e95451f0925c.jpg ├── 9f6d2b3c-2bce-4bf9-bb5e-f3c1e4136104.jpg ├── Thumbs.db ├── a720c046-08cc-4c16-a79e-483d0e71721b.jpg ├── a7878dc0-6823-483a-8ee0-462a25a468f0.jpg ├── ac578594-9dff-482c-9d00-9b4c72d17c25.jpg ├── adbf1f8c-dfdf-4f1e-9ef0-cc94cb049cd7.jpg ├── c84b833b-1c32-40b3-855a-cb45f357b50c.jpg ├── ccd2d5fc-4354-4e37-90ff-38c1a3827b9d.jpg ├── ce20ce68-6a78-4b19-a9d7-e4db742ab2eb.jpg ├── d751a929-7fab-4bb6-9f6c-3ffff067f669.jpg ├── dbc535e0-ffca-4bd1-a1d6-de02ae06e2c1.jpg ├── dd41e408-5cf7-41d9-a854-09851bbdc8e0.jpg ├── e4c00183-bb7f-489a-a966-c8eb33b28925.jpg ├── e9209488-37fe-445c-8c97-2791cd0c61f8.jpg ├── ed6422b2-18d5-4a57-8b7d-457d29e89535.jpg ├── ed6a8dca-b035-4e92-ac2b-16ef9868649c.jpg ├── f33641fd-eba9-473a-826e-06fc298e53e4.jpg ├── fbb1a064-7f28-47a5-a7e6-a6cef3967027.jpg ├── fda062b9-71ac-4c43-8bf8-2133d05e35c0.jpg ├── ff42e01f-23b6-4e42-bc9a-636f6a94ef6d.jpg └── logo.jpg /.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 | -------------------------------------------------------------------------------- /.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 341 | -------------------------------------------------------------------------------- /Business/Abstract/IAuthService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using Core.Utilities.Security.JWT; 4 | using Entities.DTOs; 5 | 6 | namespace Business.Abstract 7 | { 8 | public interface IAuthService 9 | { 10 | IDataResult Register(UserForRegisterDto registerDto, string password); 11 | IDataResult Login(UserForLoginDto loginDto); 12 | IResult UserExists(string email); 13 | IDataResult CreateAccessToken(User user); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Business/Abstract/IBrandService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Business.Abstract 8 | { 9 | public interface IBrandService 10 | { 11 | IDataResult> GetAllBrand(); 12 | IDataResult GetBrandById(int brandId); 13 | IResult Add(Brand brand); 14 | IResult Update(Brand brand); 15 | IResult Delete(Brand brand); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Business/Abstract/ICarImageService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using Microsoft.AspNetCore.Http; 5 | using System.Collections.Generic; 6 | 7 | namespace Business.Abstract 8 | { 9 | public interface ICarImageService 10 | { 11 | IDataResult> GetAll(); 12 | IDataResult Get(int id); 13 | IDataResult> GetByCarId(int carId); 14 | IResult Add(IFormFile file, CarImage carImage); 15 | IResult Update(IFormFile file, CarImage carImage); 16 | IResult Delete(CarImage carImage); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /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 | 8 | namespace Business.Abstract 9 | { 10 | public interface ICarService 11 | { 12 | IResult Add(Car car); 13 | IResult Update(Car car); 14 | IResult Delete(Car car); 15 | IDataResult GetById(int carId); 16 | IDataResult> GetAll(); 17 | IDataResult> GetCarDetails(Expression> filter = null); 18 | IDataResult> GetCarDetailsById(int carId); 19 | IDataResult> GetCarsDetailByBrandId(int brandId); 20 | IDataResult> GetCarsDetailByColorId(int colorId); 21 | IDataResult> GetCarDetailsByBrandAndColor(int brandId, int colorId); 22 | 23 | /* 24 | IResult AddTransactionalTest(Car car); 25 | 26 | IResult TransactionalOperation(Car car);*/ 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Business/Abstract/IColorService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Business.Abstract 8 | { 9 | public interface IColorService 10 | { 11 | IDataResult> GetAllColor(); 12 | IDataResult GetColorById(int colorId); 13 | IResult Add(Color color); 14 | IResult Update(Color color); 15 | IResult Delete(Color color); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Business/Abstract/ICustomerService.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.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface ICustomerService 11 | { 12 | IDataResult> GetAllCustomer(); 13 | IDataResult> GetCustomerDetails(); 14 | IDataResult GetCustomerById(int customerId); 15 | IResult Add(Customer customer); 16 | IResult Update(Customer customer); 17 | IResult Delete(Customer customer); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Business/Abstract/IPaymentService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete.Payment; 2 | using Core.Utilities.Results; 3 | 4 | namespace Business.Abstract 5 | { 6 | public interface IPaymentService 7 | { 8 | IResult MakePayment(IPaymentModel paymentModel); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Business/Abstract/IRentalService.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.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface IRentalService 11 | { 12 | IResult Add(Rental rental); 13 | IResult Update(Rental rental); 14 | IResult Delete(Rental rental); 15 | IDataResult> GetAll(); 16 | IDataResult GetById(int rentalId); 17 | IDataResult> GetRentalDetailsById(int id); 18 | IDataResult> GetRentalDetails(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Business/Abstract/IUserService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using Entities.Concrete; 4 | using System.Collections.Generic; 5 | 6 | namespace Business.Abstract 7 | { 8 | public interface IUserService 9 | { 10 | IResult Add(User user); 11 | IResult Update(User user); 12 | IResult Delete(User user); 13 | IResult UpdateProfile(User user, string password); 14 | IDataResult> GetAll(); 15 | IDataResult GetById(int userId); 16 | 17 | IDataResult> GetClaims(User user); 18 | IDataResult GetByEmail(string email); 19 | 20 | IDataResult GetUserFindeks(Findeks findeks); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Business/Business.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Business/BusinessAspects/Autofac/SecuredOperation.cs: -------------------------------------------------------------------------------- 1 | using Business.Constants; 2 | using Castle.DynamicProxy; 3 | using Core.Extensions; 4 | using Core.Utilities.Interceptors; 5 | using Core.Utilities.IoC; 6 | using Microsoft.AspNetCore.Http; 7 | using Microsoft.Extensions.DependencyInjection; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | 12 | 13 | namespace Business.BusinessAspects.Autofac 14 | { 15 | public class SecuredOperation : MethodInterception 16 | { 17 | private string[] _roles; 18 | private IHttpContextAccessor _httpContextAccessor; 19 | 20 | public SecuredOperation(string roles) 21 | { 22 | _roles = roles.Split(','); 23 | _httpContextAccessor = ServiceTool.ServiceProvider.GetService(); 24 | 25 | } 26 | 27 | protected override void OnBefore(IInvocation invocation) 28 | { 29 | var roleClaims = _httpContextAccessor.HttpContext.User.ClaimRoles(); 30 | foreach (var role in _roles) 31 | { 32 | if (roleClaims.Contains(role)) 33 | { 34 | return; 35 | } 36 | } 37 | throw new Exception(Messages.AuthorizationDenied); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Business/Concrate/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 | 9 | namespace Business.Concrate 10 | { 11 | public class AuthManager : IAuthService 12 | { 13 | private IUserService _userService; 14 | private ITokenHelper _tokenHelper; 15 | 16 | public AuthManager(IUserService userService, ITokenHelper tokenHelper) 17 | { 18 | _userService = userService; 19 | _tokenHelper = tokenHelper; 20 | } 21 | 22 | public IDataResult Register(UserForRegisterDto userForRegisterDto, string password) 23 | { 24 | byte[] passwordHash, passwordSalt; 25 | HashingHelper.CreatePasswordHash(password, out passwordHash, out passwordSalt); 26 | var user = new User 27 | { 28 | Email = userForRegisterDto.Email, 29 | FirstName = userForRegisterDto.FirstName, 30 | LastName = userForRegisterDto.LastName, 31 | PasswordHash = passwordHash, 32 | PasswordSalt = passwordSalt, 33 | Status = true 34 | }; 35 | _userService.Add(user); 36 | return new SuccessDataResult(user, Messages.UserRegistered); 37 | } 38 | 39 | public IDataResult Login(UserForLoginDto userForLoginDto) 40 | { 41 | var userToCheck = _userService.GetByEmail(userForLoginDto.Email).Data; 42 | if (userToCheck == null) 43 | { 44 | return new ErrorDataResult(Messages.UserNotFound); 45 | } 46 | 47 | if (!HashingHelper.VerifyPasswordHash(userForLoginDto.Password, userToCheck.PasswordHash, userToCheck.PasswordSalt)) 48 | { 49 | return new ErrorDataResult(Messages.PasswordError); 50 | } 51 | 52 | return new SuccessDataResult(userToCheck, Messages.SuccessfulLogin); 53 | } 54 | 55 | public IResult UserExists(string email) 56 | { 57 | var result = _userService.GetByEmail(email).Data; 58 | if ( result != null) 59 | { 60 | return new ErrorResult(Messages.UserAlreadyExists); 61 | } 62 | return new SuccessResult(); 63 | } 64 | 65 | public IDataResult CreateAccessToken(User user) 66 | { 67 | var claims = _userService.GetClaims(user).Data; 68 | var accessToken = _tokenHelper.CreateToken(user, claims); 69 | return new SuccessDataResult(accessToken, Messages.AccessTokenCreated); 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /Business/Concrate/BrandManager.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.Text; 9 | 10 | namespace Business.Concrate 11 | { 12 | public class BrandManager : IBrandService 13 | { 14 | IBrandDal _brandDal; 15 | 16 | public BrandManager(IBrandDal brandDal) 17 | { 18 | _brandDal = brandDal; 19 | } 20 | 21 | public IResult Add(Brand brand) 22 | { 23 | if (brand.BrandName.Length < 2) 24 | { 25 | return new ErrorResult(Messages.BrandNameInvalid); 26 | } 27 | _brandDal.Add(brand); 28 | return new SuccessResult(Messages.BrandAdded); 29 | } 30 | 31 | public IResult Delete(Brand brand) 32 | { 33 | _brandDal.Delete(brand); 34 | return new SuccessResult(Messages.BrandDeleted); 35 | } 36 | 37 | public IDataResult> GetAllBrand() 38 | { 39 | if (DateTime.Now.Hour == 21) 40 | { 41 | return new ErrorDataResult>(Messages.MaintenanceTime); 42 | } 43 | return new SuccessDataResult>(_brandDal.GetAll(),Messages.BrandsListed); 44 | } 45 | 46 | public IDataResult GetBrandById(int brandId) 47 | { 48 | if (DateTime.Now.Hour == 00) 49 | { 50 | return new ErrorDataResult(Messages.MaintenanceTime); 51 | } 52 | return new SuccessDataResult(_brandDal.Get(b => b.BrandId == brandId)); 53 | } 54 | 55 | public IResult Update(Brand brand) 56 | { 57 | _brandDal.Update(brand); 58 | return new SuccessResult(Messages.BrandUpdated); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Business/Concrate/CarImageManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Core.Utilities.Business; 4 | using Core.Utilities.Operations; 5 | using Core.Utilities.Results; 6 | using DataAccess.Abstract; 7 | using Entities.Concrete; 8 | using Microsoft.AspNetCore.Http; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.IO; 13 | using System.Linq.Expressions; 14 | using Core.Aspects.Autofac.Caching; 15 | using Core.Aspects.Autofac.Performance; 16 | using Entities.DTOs; 17 | using Core.Aspects.Autofac.Validation; 18 | using Business.BusinessAspects.Autofac; 19 | 20 | namespace Business.Concrate 21 | { 22 | public class CarImageManager: ICarImageService 23 | { 24 | ICarImageDal _carImageDal; 25 | private ICarService _carService; 26 | public CarImageManager(ICarImageDal carImageDal, ICarService carService) 27 | { 28 | _carImageDal = carImageDal; 29 | _carService = carService; 30 | } 31 | 32 | [CacheAspect] 33 | public IDataResult> GetAll() 34 | { 35 | return new SuccessDataResult>(_carImageDal.GetAll()); 36 | } 37 | 38 | [CacheAspect] 39 | [PerformanceAspect(5)] 40 | public IDataResult Get(int id) 41 | { 42 | var carImage = _carImageDal.Get(ci => ci.Id == id); 43 | if (carImage == null) return new ErrorDataResult(Messages.CarImageNotFound); 44 | return new SuccessDataResult(carImage); 45 | } 46 | 47 | public IDataResult> GetByCarId(int carId) 48 | { 49 | var result = _carService.GetCarDetails(ci => ci.CarId == carId); 50 | if (result.Data.Any()) return new SuccessDataResult>(result.Data); 51 | return new SuccessDataResult>(new List 52 | { 53 | new CarDetailDto{ ImagePath = "logo.jpg", Date = DateTime.Now } 54 | }); 55 | } 56 | 57 | // [SecuredOperation("CarImage.Add")] 58 | //[ValidationAspect(typeof(CarImageValidator))] 59 | public IResult Add(IFormFile file, CarImage carImage) 60 | { 61 | var result = BusinessRules.Run(CheckCarImagesCount(carImage.CarId)); 62 | if (result != null) return result; 63 | carImage.ImagePath = FileOperations.SaveImageFile("Images", file); 64 | carImage.Date = DateTime.Now; 65 | _carImageDal.Add(carImage); 66 | return new SuccessResult(Messages.CarImageAdded); 67 | } 68 | 69 | //[ValidationAspect(typeof(CarImageValidator))] 70 | [SecuredOperation("CarImage.Update")] 71 | public IResult Update(IFormFile file, CarImage carImage) 72 | { 73 | var entity = _carImageDal.Get(ci => ci.Id == carImage.Id); 74 | if (entity == null) return new ErrorResult(Messages.CarImageNotFound); 75 | FileOperations.DeleteImageFile(entity.ImagePath); 76 | entity.ImagePath = FileOperations.SaveImageFile("Images", file); 77 | entity.Date = DateTime.Now; 78 | _carImageDal.Update(entity); 79 | return new SuccessResult(Messages.CarImageUpdated); 80 | } 81 | 82 | [SecuredOperation("CarImage.Delete")] 83 | public IResult Delete(CarImage carImage) 84 | { 85 | var entity = _carImageDal.Get(ci => ci.Id == carImage.Id); 86 | if (entity == null) return new ErrorResult(Messages.CarImageNotFound); 87 | FileOperations.DeleteImageFile(entity.ImagePath); 88 | _carImageDal.Delete(carImage); 89 | return new SuccessResult(Messages.DeletedCarImage); 90 | } 91 | private IResult CheckCarImagesCount(int carId) 92 | { 93 | var result = _carImageDal.GetAll(ci => ci.CarId == carId).Count < 5; 94 | if (!result) return new ErrorResult(Messages.CarImageLimitExceeded); 95 | return new SuccessResult(); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Business/Concrate/CarManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.BusinessAspects.Autofac; 3 | using Business.Constants; 4 | using Business.ValidationRules.FluentValidation; 5 | using Core.Aspects.Autofac.Caching; 6 | using Core.Aspects.Autofac.Logging; 7 | using Core.Aspects.Autofac.Performance; 8 | using Core.Aspects.Autofac.Transaction; 9 | using Core.Aspects.Autofac.Validation; 10 | using Core.CrossCuttingConcerns.Logging.Log4Net.Loggers; 11 | using Core.Utilities.Results; 12 | using DataAccess.Abstract; 13 | using Entities.Concrete; 14 | using Entities.DTOs;using System;using System.Collections.Generic; 15 | using System.Linq.Expressions; 16 | 17 | namespace Business.Concrate 18 | { 19 | public class CarManager : ICarService 20 | { 21 | ICarDal _carDal; 22 | 23 | public CarManager(ICarDal carDal) 24 | { 25 | _carDal = carDal; 26 | } 27 | 28 | [ValidationAspect(typeof(CarValidator))] 29 | [CacheRemoveAspect("ICarService.Get")] 30 | [SecuredOperation("Car.Add")] 31 | public IResult Add(Car car) 32 | { 33 | if (car.MinFindeksScore == 0) 34 | { 35 | car.MinFindeksScore = (new Random().Next(1, 190)) * 10; 36 | } 37 | _carDal.Add(car); 38 | return new SuccessResult(Messages.CarAdded); 39 | 40 | } 41 | [SecuredOperation("Car.Delete")] 42 | public IResult Delete(Car car) 43 | { 44 | _carDal.Delete(car); 45 | return new SuccessResult(Messages.CarDeleted); 46 | } 47 | 48 | [CacheAspect] 49 | public IDataResult> GetAll() 50 | { 51 | if (DateTime.Now.Hour == 5) 52 | { 53 | return new ErrorDataResult>(Messages.MaintenanceTime); 54 | } 55 | 56 | return new SuccessDataResult>(_carDal.GetAll(), Messages.CarsListed); 57 | } 58 | 59 | [CacheAspect] 60 | [PerformanceAspect(5)] 61 | public IDataResult GetById(int carId) 62 | { 63 | if (DateTime.Now.Hour == 5) 64 | { 65 | return new ErrorDataResult(Messages.MaintenanceTime); 66 | } 67 | return new SuccessDataResult(_carDal.Get(c => c.CarId == carId)); 68 | } 69 | 70 | [CacheAspect] 71 | public IDataResult> GetCarDetails(Expression> filter = null) 72 | { 73 | if (DateTime.Now.Hour == 5) 74 | { 75 | return new ErrorDataResult>(Messages.MaintenanceTime); 76 | } 77 | return new SuccessDataResult>(_carDal.GetCarDetails()); 78 | } 79 | 80 | public IDataResult> GetCarDetailsByBrandAndColor(int brandId, int colorId) 81 | { 82 | return new SuccessDataResult>(_carDal.GetCarDetailsByBrandAndColor(brandId, colorId)); 83 | } 84 | public IDataResult> GetCarDetailsById(int carId) 85 | { 86 | if (DateTime.Now.Hour == 5) 87 | { 88 | return new ErrorDataResult>(Messages.MaintenanceTime); 89 | } 90 | return new SuccessDataResult>(_carDal.GetCarDetailById(carId)); 91 | } 92 | 93 | [CacheAspect] 94 | public IDataResult> GetCarBrandandColor(int brandId, int colorId) 95 | { 96 | if (DateTime.Now.Hour == 5) 97 | { 98 | return new ErrorDataResult>(Messages.MaintenanceTime); 99 | } 100 | return new SuccessDataResult>(_carDal.GetCarDetails(p => p.BrandId == brandId && p.ColorId == colorId)); 101 | } 102 | 103 | [CacheAspect] 104 | public IDataResult> GetCarsDetailByBrandId(int brandId) 105 | { 106 | if (DateTime.Now.Hour == 5) 107 | { 108 | return new ErrorDataResult>(Messages.MaintenanceTime); 109 | } 110 | return new SuccessDataResult>(_carDal.GetCarDetails(p => p.BrandId == brandId)); 111 | } 112 | 113 | [CacheAspect] 114 | public IDataResult> GetCarsDetailByColorId(int colorId) 115 | { 116 | if (DateTime.Now.Hour == 5) 117 | { 118 | return new ErrorDataResult>(Messages.MaintenanceTime); 119 | } 120 | return new SuccessDataResult>(_carDal.GetCarDetails(p => p.ColorId == colorId)); 121 | } 122 | 123 | 124 | //[SecuredOperation("Car.Update")] 125 | public IResult Update(Car car) 126 | { 127 | if (car.DailyPrice > 0) 128 | { 129 | _carDal.Update(car); 130 | return new SuccessResult(Messages.CarUpdated); 131 | } 132 | _carDal.Update(car); 133 | return new SuccessResult(Messages.CarPriceInvalid); 134 | } 135 | /* 136 | [TransactionScopeAspect] 137 | public IResult AddTransactionalTest(Car car) 138 | { 139 | 140 | Add(car); 141 | if (car.DailyPrice < 10) 142 | { 143 | throw new Exception(""); 144 | } 145 | 146 | Add(car); 147 | 148 | return null; 149 | }*/ 150 | /* 151 | [TransactionScopeAspect] 152 | public IResult TransactionalOperation(Car car) 153 | { 154 | _carDal.Update(car); 155 | _carDal.Add(car); 156 | return new SuccessResult(Messages.CarUpdated); 157 | }*/ 158 | } 159 | } -------------------------------------------------------------------------------- /Business/Concrate/ColorManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.BusinessAspects.Autofac; 3 | using Business.Constants; 4 | using Core.Aspects.Autofac.Caching; 5 | using Core.Aspects.Autofac.Validation; 6 | using Core.Utilities.Results; 7 | using DataAccess.Abstract; 8 | using Entities.Concrete; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Text; 12 | 13 | namespace Business.Concrate 14 | { 15 | public class ColorManager : IColorService 16 | { 17 | IColorDal _colorDal; 18 | 19 | public ColorManager(IColorDal colorDal) 20 | { 21 | _colorDal = colorDal; 22 | } 23 | 24 | //[ValidationAspect(typeof(ColorValidator))] 25 | [CacheRemoveAspect("IColorService.Get")] 26 | [SecuredOperation("Color.Add")] 27 | public IResult Add(Color color) 28 | { 29 | if (color.ColorName.Length < 2) 30 | { 31 | return new ErrorResult(Messages.ColorNameInvalid); 32 | } 33 | _colorDal.Add(color); 34 | return new SuccessResult(Messages.ColorAdded); 35 | } 36 | 37 | [SecuredOperation("Color.Delete")] 38 | public IResult Delete(Color color) 39 | { 40 | _colorDal.Delete(color); 41 | return new SuccessResult(Messages.ColorDeleted); 42 | } 43 | 44 | public IDataResult> GetAllColor() 45 | { 46 | if (DateTime.Now.Hour == 21) 47 | { 48 | return new ErrorDataResult>(Messages.MaintenanceTime); 49 | } 50 | return new SuccessDataResult>(_colorDal.GetAll(), Messages.CarsListed); 51 | } 52 | 53 | public IDataResult GetColorById(int colorId) 54 | { 55 | return new SuccessDataResult(_colorDal.Get(c => c.ColorId == colorId)); 56 | } 57 | 58 | public IResult Update(Color color) 59 | { 60 | if (color.ColorName.Length < 2) 61 | { 62 | return new ErrorResult(Messages.ColorNameInvalid); 63 | } 64 | _colorDal.Update(color); 65 | return new SuccessResult(Messages.ColorUpdated); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Business/Concrate/CustomerManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Core.Utilities.Results; 4 | using DataAccess.Abstract; 5 | using Entities.Concrete; 6 | using Entities.DTOs; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | 11 | namespace Business.Concrate 12 | { 13 | public class CustomerManager : ICustomerService 14 | { 15 | ICustomerDal _customerDal; 16 | 17 | public CustomerManager(ICustomerDal customerDal) 18 | { 19 | _customerDal = customerDal; 20 | } 21 | 22 | public IResult Add(Customer customer) 23 | { 24 | if (customer.CompanyName.Length < 2) 25 | { 26 | return new ErrorResult(Messages.CustomerNameInvalid); 27 | } 28 | _customerDal.Add(customer); 29 | return new SuccessResult(Messages.CustomerAdded); 30 | } 31 | 32 | public IResult Delete(Customer customer) 33 | { 34 | _customerDal.Delete(customer); 35 | return new SuccessResult(Messages.CustomerDeleted); 36 | } 37 | 38 | public IDataResult> GetAllCustomer() 39 | { 40 | if (DateTime.Now.Hour == 22) 41 | { 42 | return new ErrorDataResult>(Messages.MaintenanceTime); 43 | } 44 | return new SuccessDataResult>(_customerDal.GetAll(), Messages.CustomersListed); 45 | } 46 | 47 | public IDataResult GetCustomerById(int customerId) 48 | { 49 | return new SuccessDataResult(_customerDal.Get(c => c.Id== customerId)); 50 | } 51 | 52 | 53 | public IDataResult> GetCustomerDetails() 54 | { 55 | if (DateTime.Now.Hour == 22) 56 | { 57 | return new ErrorDataResult>(Messages.MaintenanceTime); 58 | } 59 | return new SuccessDataResult>(_customerDal.GetCustomerDetails(), Messages.CustomerDetailsListed); 60 | } 61 | public IResult Update(Customer customer) 62 | { 63 | if (customer.CompanyName.Length < 2) 64 | { 65 | return new ErrorResult(Messages.CustomerNameInvalid); 66 | } 67 | _customerDal.Update(customer); 68 | return new SuccessResult(Messages.CustomerUpdated); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Business/Concrate/PaymentManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Aspects.Autofac.Performance; 3 | using Core.Aspects.Autofac.Transaction; 4 | using Core.Aspects.Autofac.Validation; 5 | using Core.Entities.Concrete.Payment; 6 | using Core.Utilities.Results; 7 | 8 | 9 | namespace Business.Concrate 10 | { 11 | public class PaymentManager : IPaymentService 12 | { 13 | //[ValidationAspect(typeof(FakePaymentValidator))] 14 | [PerformanceAspect(5)] 15 | [TransactionScopeAspect] 16 | public IResult MakePayment(IPaymentModel paymentModel) 17 | { 18 | return new SuccessResult(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Business/Concrate/RentalManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.BusinessAspects.Autofac; 3 | using Business.Constants; 4 | using Core.Aspects.Autofac.Caching; 5 | using Core.Aspects.Autofac.Performance; 6 | using Core.Aspects.Autofac.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.Text; 14 | 15 | namespace Business.Concrate 16 | { 17 | public class RentalManager : IRentalService 18 | { 19 | IRentalDal _rentalDal; 20 | public RentalManager(IRentalDal rentalDal) 21 | { 22 | _rentalDal = rentalDal; 23 | } 24 | 25 | //[ValidationAspect(typeof(RentalValidator))] 26 | [CacheRemoveAspect("IRentalService.Get")] 27 | //[SecuredOperation("Rental.Add")] 28 | public IResult Add(Rental rental) 29 | { 30 | if (rental.ReturnDate == null && _rentalDal.GetRentalDetailsById(rental.CarId).Count > 0) 31 | return new ErrorResult(Messages.notReturned); 32 | 33 | _rentalDal.Add(rental); 34 | return new SuccessResult(Messages.RentalAdded); 35 | } 36 | public bool CheckReturnDate(int carId) 37 | { 38 | var result = _rentalDal.GetAll(r => r.CarId == carId && r.ReturnDate == null); 39 | if (result.Count > 0) 40 | { 41 | return false; 42 | } 43 | return true; 44 | } 45 | 46 | [SecuredOperation("Rental.Delete")] 47 | public IResult Delete(Rental rental) 48 | { 49 | _rentalDal.Delete(rental); 50 | return new SuccessResult(Messages.RentalDeleted); 51 | } 52 | 53 | [CacheAspect] 54 | public IDataResult> GetAll() 55 | { 56 | if (DateTime.Now.Hour == 22) 57 | { 58 | return new ErrorDataResult>(Messages.MaintenanceTime); 59 | } 60 | return new SuccessDataResult>(_rentalDal.GetAll(), Messages.RentalsListed); 61 | } 62 | 63 | public IDataResult GetRentalByCarId(int carId) 64 | { 65 | return new SuccessDataResult(_rentalDal.Get(c => c.CarId == carId)); 66 | } 67 | public IDataResult GetRentalByCustomerId(int customerId) 68 | { 69 | return new SuccessDataResult(_rentalDal.Get(c => c.CustomerId == customerId)); 70 | } 71 | 72 | public IDataResult GetRentalById(int rentalId) 73 | { 74 | return new SuccessDataResult(_rentalDal.Get(c => c.Id == rentalId)); 75 | } 76 | 77 | [CacheAspect] 78 | [PerformanceAspect(5)] 79 | public IDataResult GetById(int id) 80 | { 81 | if (DateTime.Now.Hour == 00) 82 | { 83 | return new ErrorDataResult(Messages.MaintenanceTime); 84 | } 85 | return new SuccessDataResult(_rentalDal.Get(b => b.Id == id)); 86 | } 87 | 88 | public IDataResult> GetRentalDetailsById(int id) 89 | { 90 | return new SuccessDataResult>(_rentalDal.GetRentalDetailsById(id)); 91 | } 92 | 93 | [CacheAspect] 94 | public IDataResult> GetRentalDetails() 95 | { 96 | if (DateTime.Now.Hour == 00) 97 | { 98 | return new ErrorDataResult>(Messages.MaintenanceTime); 99 | } 100 | return new SuccessDataResult>(_rentalDal.GetRentalDetails()); 101 | } 102 | 103 | [SecuredOperation("Rental.Update")] 104 | public IResult Update(Rental rental) 105 | { 106 | _rentalDal.Update(rental); 107 | return new SuccessResult(Messages.RentalUpdated); 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /Business/Concrate/UserManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.BusinessAspects.Autofac; 3 | using Business.Constants; 4 | using Core.Aspects.Autofac.Caching; 5 | using Core.Aspects.Autofac.Performance; 6 | using Core.Aspects.Autofac.Validation; 7 | using Core.Entities.Concrete; 8 | using Core.Utilities.Results; 9 | using Core.Utilities.Security.Hashing; 10 | using DataAccess.Abstract; 11 | using Entities.Concrete; 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Text; 15 | 16 | 17 | namespace Business.Concrate 18 | { 19 | public class UserManager : IUserService 20 | { 21 | IUserDal _userDal; 22 | 23 | public UserManager(IUserDal userDal) 24 | { 25 | _userDal = userDal; 26 | } 27 | 28 | //[ValidationAspect(typeof(UserValidator))] 29 | [CacheRemoveAspect("IUserService.Get")] 30 | public IResult Add(User user) 31 | { 32 | _userDal.Add(user); 33 | return new SuccessResult(Messages.UserAdded); 34 | } 35 | 36 | 37 | public IResult UpdateProfile(User user, string password) 38 | { 39 | byte[] passwordHash, passwordSalt; 40 | HashingHelper.CreatePasswordHash(password, out passwordHash, out passwordSalt); 41 | var updatedUser = new User 42 | { 43 | Id = user.Id, 44 | Email = user.Email, 45 | FirstName = user.FirstName, 46 | LastName = user.LastName, 47 | PasswordHash = passwordHash, 48 | PasswordSalt = passwordSalt, 49 | Status = user.Status 50 | }; 51 | _userDal.Update(updatedUser); 52 | return new SuccessDataResult(Messages.UserUpdated); 53 | } 54 | [SecuredOperation("User.Delete")] 55 | public IResult Delete(User user) 56 | { 57 | _userDal.Delete(user); 58 | return new SuccessResult(Messages.UserDeleted); 59 | } 60 | 61 | [CacheAspect] 62 | public IDataResult> GetAll() 63 | { 64 | if (DateTime.Now.Hour == 22) 65 | { 66 | return new ErrorDataResult>(Messages.MaintenanceTime); 67 | } 68 | return new SuccessDataResult>(_userDal.GetAll(), Messages.UsersListed); 69 | } 70 | 71 | [CacheAspect] 72 | [PerformanceAspect(5)] 73 | public IDataResult GetById(int userId) 74 | { 75 | return new SuccessDataResult(_userDal.Get(u => u.Id == userId)); 76 | } 77 | 78 | public IResult Update(User user) 79 | { 80 | if (user.FirstName.Length < 2) 81 | { 82 | return new ErrorResult(Messages.UserNameInvalid); 83 | } 84 | _userDal.Update(user); 85 | return new SuccessResult(Messages.UserUpdated); 86 | } 87 | 88 | [CacheAspect] 89 | public IDataResult> GetClaims(User user) 90 | { 91 | return new SuccessDataResult>(_userDal.GetClaims(user)); 92 | } 93 | 94 | [CacheAspect] 95 | [PerformanceAspect(5)] 96 | public IDataResult GetByEmail(string email) 97 | { 98 | var result = new SuccessDataResult(_userDal.Get(u => u.Email == email)); 99 | return result; 100 | } 101 | 102 | public IDataResult GetUserFindeks(Findeks findeks) 103 | { 104 | Random rnd = new Random(); 105 | var userFindeks = new Findeks 106 | { 107 | Tc = findeks.Tc, 108 | DateYear = findeks.DateYear, 109 | UserFindeks = rnd.Next(0, 1900) 110 | }; 111 | return new SuccessDataResult(userFindeks); 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /Business/Constants/Messages.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Runtime.Serialization; 6 | using System.Text; 7 | 8 | namespace Business.Constants 9 | { 10 | public static class Messages 11 | { 12 | public static string[] ValidImageFileTypes = { ".JPG", ".JPEG", ".PNG", ".ICO" }; 13 | 14 | public static string CarsListed = "Arabalar listelendi"; 15 | public static string CarAdded = "Araba eklendi"; 16 | public static string CarUpdated = "Araba güncellendi"; 17 | public static string CarDeleted = "Araba silindi"; 18 | public static string CarNameInvalid = "Araba ismi geçersiz"; 19 | public static string MaintenanceTime = "Sistem bakımda"; 20 | public static string CarPriceInvalid = "Araç günlük fiyatı için girdiğiniz değer 0 dan büyük olmalıdır."; 21 | public static string notReturned = "Araç henüz teslim edilmemiş"; 22 | 23 | public static string BrandsListed = "Markalar listelendi"; 24 | public static string BrandAdded = "Marka eklendi"; 25 | public static string BrandUpdated = "Marka güncellendi"; 26 | public static string BrandDeleted = "Marka silindi"; 27 | public static string BrandNameInvalid = "Marka ismi geçersiz"; 28 | 29 | public static string ColorsListed = "Renkler listelendi"; 30 | public static string ColorAdded = "Renk eklendi"; 31 | public static string ColorUpdated = "Renk güncellendi"; 32 | public static string ColorDeleted = "Renk silindi"; 33 | public static string ColorNameInvalid = "Renk ismi geçersiz"; 34 | 35 | public static string CustomersListed = "Müşteriler listelendi"; 36 | public static string CustomerAdded = "Müşteri eklendi"; 37 | public static string CustomerUpdated = "Müşteri güncellendi"; 38 | public static string CustomerDeleted = "Müşteri silindi"; 39 | public static string CustomerNameInvalid = "Müşteri ismi geçersiz"; 40 | public static string CustomerDetailsListed="Müşteri detayları listelendi"; 41 | 42 | public static string RentalsListed = "Kiralamaler listelendi"; 43 | public static string RentalAdded = "Kiralama eklendi"; 44 | public static string RentalUpdated = "Kiralama güncellendi"; 45 | public static string RentalDeleted = "Kiralama silindi"; 46 | public static string RentalInvalid = "Araç önceden kiralanmış"; 47 | 48 | public static string UsersListed = "Kullanıcıler listelendi"; 49 | public static string UserAdded = "Kullanıcı eklendi"; 50 | public static string UserUpdated = "Kullanıcı güncellendi"; 51 | public static string UserDeleted = "Kullanıcı silindi"; 52 | public static string UserNameInvalid = "Kullanıcı ismi geçersiz"; 53 | 54 | 55 | public static string CarImageLimitExceed = "Arabaya ait 5 adet resim mevcut, bir araç için en fazla 5 resim ekleyebilirsiniz."; 56 | public static string CarImageLimitExceeded = "Bir araba için en fazla 5 resim eklenebilir."; 57 | public static string CarImageAdded = "Araba resmi eklendi"; 58 | public static string DeletedCarImage = "Araba resmi silindi"; 59 | public static string CarImageUpdated = "Araç resmi güncellendi"; 60 | public static string CarImageNotFound = "Resim bulunamadı"; 61 | public static string InvalidImageExtension = "Geçersiz dosya uzantısı, resim için kabul edilen uzantılar" + string.Join(",", ValidImageFileTypes); 62 | public static string CarHaveNoImage="Araca ait resim bulunamadı"; 63 | 64 | public static string AuthorizationDenied = "Yetkiniz yok"; 65 | public static string UserRegistered = "Kayıt oldu"; 66 | public static string UserNotFound = "Kullanıcı bulunamadı"; 67 | public static string PasswordError = "Parola hatası"; 68 | public static string SuccessfulLogin = "Başarılı Giriş"; 69 | public static string UserAlreadyExists = "Kullanıcı mevcut"; 70 | public static string AccessTokenCreated = "Token oluşturuldu"; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Business/DependencyResolvers/Autofac/AutofacBusinessModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Extras.DynamicProxy; 3 | using Business.Abstract; 4 | using Business.Concrate; 5 | using Castle.DynamicProxy; 6 | using Core.Utilities.Interceptors; 7 | using Core.Utilities.Security.JWT; 8 | using DataAccess.Abstract; 9 | using DataAccess.Concrate.EntityFramework; 10 | using Microsoft.AspNetCore.Http; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | 15 | namespace Business.DependencyResolvers.Autofac 16 | { 17 | public class AutofacBusinessModule : Module 18 | { 19 | 20 | protected override void Load(ContainerBuilder builder) 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(); 41 | builder.RegisterType().As(); 42 | 43 | 44 | builder.RegisterType().As(); 45 | builder.RegisterType().As(); 46 | 47 | builder.RegisterType().As(); 48 | 49 | 50 | var assembly = System.Reflection.Assembly.GetExecutingAssembly(); 51 | 52 | builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces() 53 | .EnableInterfaceInterceptors(new ProxyGenerationOptions() 54 | { 55 | Selector = new AspectInterceptorSelector() 56 | }).SingleInstance(); 57 | 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /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(c => c.ModelYear).NotEmpty(); 14 | RuleFor(c => c.Description).NotEmpty(); 15 | RuleFor(c => c.DailyPrice).NotEmpty(); 16 | RuleFor(c => c.ModelYear).LessThanOrEqualTo(DateTime.Now.Year); 17 | RuleFor(c => c.Description).MinimumLength(2); 18 | RuleFor(c => c.DailyPrice).GreaterThan(0); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ConsoleUI/ConsoleUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ConsoleUI/Program.cs: -------------------------------------------------------------------------------- 1 | using Business.Concrate; 2 | using Core.Entities.Concrete; 3 | using DataAccess.Concrate.EntityFramework; 4 | using DataAccess.Concrate.InMemory; 5 | using Entities.Concrete; 6 | using System; 7 | using System.Collections.Generic; 8 | 9 | namespace ConsoleUI 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | CarManager carManager = new CarManager(new EfCarDal()); 16 | BrandManager brandManager = new BrandManager(new EfBrandDal()); 17 | ColorManager colorManager = new ColorManager(new EfColorDal()); 18 | CustomerManager customerManager = new CustomerManager(new EfCustomerDal()); 19 | RentalManager rentalManager = new RentalManager(new EfRentalDal()); 20 | UserManager userManager = new UserManager(new EfUserDal()); 21 | //Car car = new Car() { CarId = 16, BrandId = 1, ColorId = 1, DailyPrice = 222222, ModelYear = 2000, Description = "araba", CarName = "Örnek araba ismi" }; 22 | 23 | //Get Car Details Test 24 | //GetCarDetailsTest(carManager); 25 | 26 | 27 | //Get Customer Details test 28 | //GetCustomerDetailsTest(customerManager); 29 | 30 | //Get Rental Details test 31 | //GetRentalDetailsTest(rentalManager); 32 | 33 | //Get All Tests 34 | //GetAllCarTest(carManager); 35 | //GetAllBrandTest(brandManager); 36 | //GetAllColorTest(colorManager); 37 | //GetAllCustomerTest(customerManager); 38 | //GetAllRentalTest(rentalManager); 39 | //GetAllUserTest(userManager); 40 | 41 | //AddCarTest(carManager); 42 | //UpdateCarTest(carManager); 43 | //DeleteCarTest(carManager); 44 | 45 | //Get By Id Tests 46 | //GetCarByIdTest(carManager, 2); 47 | //GetBrandByIdTest(brandManager, 6); 48 | //GetColorByIdTest(colorManager, 1); 49 | 50 | //Get Cars By Color Id And Brand Id Tests 51 | //GetCarsByBrandIdTest(carManager); 52 | //GetCarsByColorIdTest(carManager); 53 | 54 | //Add, Update, Delete for Brand Tests 55 | //AddBrandTest(brandManager); 56 | //UpdateBrandTest(brandManager); 57 | //DeleteBrandTest(brandManager); 58 | 59 | //Add, Update, Delete for Color Tests 60 | //AddColorTest(colorManager); 61 | //UpdateColorTest(colorManager); 62 | //DeleteColorTest(colorManager); 63 | 64 | //Add, Update, Delete for Customer Tests 65 | //AddCustomerTest(customerManager); 66 | //UpdateCustomerTest(customerManager); 67 | //DeleteCustomerTest(customerManager); 68 | 69 | //Add, Update, Delete for Rental Tests 70 | //AddRentalTest(rentalManager); 71 | //UpdateRentalTest(rentalManager); 72 | //DeleteRentalTest(rentalManager); 73 | 74 | //Add, Update, Delete for User Tests 75 | //AddUserTest(userManager); 76 | //UpdateUserTest(userManager); 77 | //DeleteUserTest(userManager); 78 | 79 | 80 | //denemeler 81 | 82 | Console.ReadLine(); 83 | } 84 | 85 | //private static void DeleteUserTest(UserManager UserManager) 86 | //{ 87 | // UserManager.Delete(new User() { Id = 1 }); 88 | // Console.WriteLine("----- User Deleted... -----"); 89 | //} 90 | 91 | //private static void UpdateUserTest(UserManager UserManager) 92 | //{ 93 | // DateTime date = DateTime.Now; 94 | // UserManager.Update(new User() 95 | // { 96 | // Id = 2, 97 | // FirstName = "Durmuş", 98 | // LastName = "Yıldız", 99 | // Email = "durmus@yildiz.com" 100 | // }); 101 | // Console.WriteLine("----- User Updated... -----"); 102 | //} 103 | //private static void AddUserTest(UserManager UserManager) 104 | //{ 105 | // DateTime date = DateTime.Now; 106 | // UserManager.Add(new User() 107 | // { 108 | // Id = 2, 109 | // FirstName = "Duran", 110 | // LastName = "Yıldız", 111 | // Email = "duran@yildiz.com" 112 | // }); 113 | // Console.WriteLine("----- User Added... -----"); 114 | //} 115 | //private static void DeleteRentalTest(RentalManager rentalManager) 116 | //{ 117 | // rentalManager.Delete(new Rental() { Id = 1 }); 118 | // Console.WriteLine("----- Rental Deleted... -----"); 119 | //} 120 | 121 | //private static void UpdateRentalTest(RentalManager rentalManager) 122 | //{ 123 | // DateTime date = DateTime.Now; 124 | // rentalManager.Update(new Rental() { Id = 2, CarId = 4, CustomerId = 2, RentDate = date.AddHours(1) }); 125 | // Console.WriteLine("----- Rental Updated... -----"); 126 | //} 127 | 128 | //private static void AddRentalTest(RentalManager rentalManager) 129 | //{ 130 | // DateTime date = DateTime.Now; 131 | // rentalManager.Add(new Rental() { Id = 2, CarId = 4, CustomerId = 2, RentDate = date }); 132 | // Console.WriteLine("----- Rental Added... -----"); 133 | //} 134 | //private static void DeleteCustomerTest(CustomerManager customerManager) 135 | //{ 136 | // customerManager.Delete(new Customer() { Id = 1 }); 137 | // Console.WriteLine("----- Customer Deleted... -----"); 138 | //} 139 | 140 | //private static void UpdateCustomerTest(CustomerManager customerManager) 141 | //{ 142 | // customerManager.Update(new Customer() { Id = 2, UserId = 2, CompanyName = "örnek şirket" }); 143 | // Console.WriteLine("----- Customer Updated... -----"); 144 | //} 145 | 146 | //private static void AddCustomerTest(CustomerManager customerManager) 147 | //{ 148 | // customerManager.Add(new Customer() { Id = 2, UserId = 2, CompanyName = "şirket" }); 149 | // Console.WriteLine("----- Customer Added... -----"); 150 | //} 151 | 152 | //private static void GetAllUserTest(UserManager userManager) 153 | //{ 154 | // var result = userManager.GetAllUser(); 155 | // if (result.Success) 156 | // { 157 | // Separator(); 158 | // Console.WriteLine("User List:"); 159 | // foreach (var user in result.Data) 160 | // { 161 | // Console.WriteLine("User first name: " + user.FirstName + ", User last name: " 162 | // + user.LastName + ", User email: " + user.Email + ", User password: " + user.PasswordHash); 163 | // Console.WriteLine("-----Get All User Tested... -----"); 164 | // } 165 | // } 166 | // else 167 | // { 168 | // Console.WriteLine(result.Message); 169 | // } 170 | //} 171 | //private static void GetAllRentalTest(RentalManager rentalManager) 172 | //{ 173 | // var result = rentalManager.GetAllRental(); 174 | // if (result.Success) 175 | // { 176 | // Separator(); 177 | // Console.WriteLine("Rental List:"); 178 | // foreach (var rental in result.Data) 179 | // { 180 | 181 | // Console.WriteLine("Car id: " + rental.CarId + ", " + ", Customer id: " + rental.CustomerId 182 | // + ", Rent date: " + rental.RentDate + ", Return date: " + ReturnDateFix(rental.ReturnDate.ToString())); 183 | // Console.WriteLine("-----Get All Rental Tested... -----"); 184 | // } 185 | // } 186 | // else 187 | // { 188 | // Console.WriteLine(result.Message); 189 | // } 190 | //} 191 | //private static string ReturnDateFix(string ReturnDate) 192 | //{ 193 | // string dateToReturn; 194 | 195 | // if (ReturnDate == null) 196 | // dateToReturn = "Teslim Edilmedi."; 197 | // else 198 | // dateToReturn = ReturnDate.ToString(); 199 | // return dateToReturn; 200 | //} 201 | 202 | //private static void GetAllCustomerTest(CustomerManager customerManager) 203 | //{ 204 | // var result = customerManager.GetAllCustomer(); 205 | // if (result.Success) 206 | // { 207 | // Separator(); 208 | // Console.WriteLine("Customer List: "); 209 | // foreach (var customer in result.Data) 210 | // { 211 | // Console.WriteLine("User id: " + customer.UserId + " , " + customer.CompanyName); 212 | // Console.WriteLine("-----Get All Customer Tested... -----"); 213 | // } 214 | // } 215 | // else 216 | // { 217 | // Console.WriteLine(result.Message); 218 | // } 219 | //} 220 | 221 | //private static void GetCarsByColorIdTest(CarManager carManager) 222 | //{ 223 | // var result = carManager.GetCarsByColorId(9); 224 | // if (result.Success) 225 | // { 226 | // Separator(); 227 | // Console.WriteLine("Cars By Color Id List:"); 228 | // foreach (var car in result.Data) 229 | // { 230 | // Console.WriteLine("Car id: " + car.CarId + "\n" + "Car brand id: " + car.BrandId + "\n" 231 | // + "Car color id: " + car.ColorId + "\n" + "Car model year: " + car.ModelYear + "\n" 232 | // + "Car name: " + car.CarName + "\n" + "Car daily price: " + car.DailyPrice + " TL. " 233 | // + "Açıklama: " + car.Description); 234 | // } 235 | // Console.WriteLine("----- Get Cars By Color Id Details Tested... -----"); 236 | // } 237 | // else 238 | // { 239 | // Console.WriteLine(result.Message); 240 | // } 241 | //} 242 | 243 | //private static void GetCarsByBrandIdTest(CarManager carManager) 244 | //{ 245 | // var result = carManager.GetCarsByBrandId(8); 246 | // if (result.Success) 247 | // { 248 | // Separator(); 249 | // Console.WriteLine("Cars By Brand Id List:"); 250 | // foreach (var car in result.Data) 251 | // { 252 | // Console.WriteLine("Car id: " + car.CarId + "\n" + "Car brand name: " + car.BrandName + "\n" 253 | // + "Car color name: " + car.ColorName + "\n" + "Car model year: " + car.ModelYear + "\n" 254 | // + "Car name: " + car.CarName + "\n" + "Car daily price: " + car.DailyPrice + " TL. " 255 | // + "Açıklama: " + car.Description); 256 | // } 257 | // Console.WriteLine("----- Get Cars By Brand Id Details Tested... -----"); 258 | // } 259 | // else 260 | // { 261 | // Console.WriteLine(result.Message); 262 | // } 263 | //} 264 | 265 | //private static void DeleteColorTest(ColorManager colorManager) 266 | //{ 267 | // colorManager.Delete(new Color() { ColorId = 1003 }); 268 | // Console.WriteLine("----- Color Deleted... -----"); 269 | //} 270 | 271 | //private static void UpdateColorTest(ColorManager colorManager) 272 | //{ 273 | // colorManager.Update(new Color() { ColorId = 1005, ColorName = "Mor" }); 274 | // Console.WriteLine("----- Color Updated... -----"); 275 | //} 276 | 277 | //private static void AddColorTest(ColorManager colorManager) 278 | //{ 279 | // colorManager.Add(new Color() { ColorName = "Bordo" }); 280 | // Console.WriteLine("----- Color Added... -----"); 281 | //} 282 | 283 | //private static void DeleteBrandTest(BrandManager brandManager) 284 | //{ 285 | // brandManager.Delete(new Brand() { BrandId = 1003 }); 286 | // Console.WriteLine("----- Brand Deleted... -----"); 287 | //} 288 | 289 | //private static void UpdateBrandTest(BrandManager brandManager) 290 | //{ 291 | // brandManager.Update(new Brand() { BrandId = 1004, BrandName = "Audi" }); 292 | // Console.WriteLine("----- Brand Updated... -----"); 293 | //} 294 | 295 | //private static void AddBrandTest(BrandManager brandManager) 296 | //{ 297 | // brandManager.Add(new Brand() { BrandName = "Cadillac" }); 298 | // Console.WriteLine("----- Brand Added... -----"); 299 | //} 300 | 301 | //private static void GetColorByIdTest(ColorManager colorManager, int id) 302 | //{ 303 | // Separator(); 304 | // Console.WriteLine("Color By Id List:"); 305 | // var result = colorManager.GetColorById(id); 306 | // Console.WriteLine("Color id: " + result.Data.ColorId + "\n" + "Color name: " + result.Data.ColorName); 307 | // Console.WriteLine("----- Get Color By Id Tested... -----"); 308 | //} 309 | 310 | //private static void GetBrandByIdTest(BrandManager brandManager, int id) 311 | //{ 312 | // Separator(); 313 | // Console.WriteLine("Brand By Id List:"); 314 | // var result = brandManager.GetBrandById(id); 315 | // Console.WriteLine("Brand id: " + result.Data.BrandId + "\n" + "Brand name: " + result.Data.BrandName); 316 | // Console.WriteLine("----- Get Brand By Id Tested... -----"); 317 | //} 318 | 319 | ////private static void GetCarByIdTest(CarManager carManager, int id) 320 | ////{ 321 | //// var result = carManager.GetCarById(id); 322 | //// if (result.Success) 323 | //// { 324 | //// Separator(); 325 | //// Console.WriteLine("Car By Id List:"); 326 | //// Console.WriteLine("Car id: " + result.Data. + "\n" + "Car brand id: " + result.Data.BrandId + "\n" 327 | //// + "Car color id: " + result.Data.ColorId + "\n" + "Car model year: " + result.Data.ModelYear + "\n" 328 | //// + "Car name: " + result.Data.CarName + "\n" + "Car daily price: " + result.Data.DailyPrice + " TL. " 329 | //// + "Açıklama: " + result.Data.Description); 330 | //// Console.WriteLine("----- Get Car By Id Tested... -----"); 331 | //// } 332 | //// else 333 | //// { 334 | //// Console.WriteLine(result.Message); 335 | //// } 336 | ////} 337 | 338 | //private static void AddCarTest(CarManager carManager) 339 | //{ 340 | // carManager.Add(new Car() { CarId = 14, BrandId = 1, ColorId = 1, DailyPrice = 111111, ModelYear = 2000, Description = "araba", CarName = "Corsa" }); 341 | // Console.WriteLine("----- Car Added... -----"); 342 | //} 343 | 344 | //private static void UpdateCarTest(CarManager carManager) 345 | //{ 346 | // carManager.Update(new Car() { CarId = 13, BrandId = 5, ColorId = 1, DailyPrice = 222222, ModelYear = 2000, Description = "araç", CarName = "Symbol" }); 347 | // Console.WriteLine("----- Car Updated... -----"); 348 | //} 349 | 350 | //private static void DeleteCarTest(CarManager carManager) 351 | //{ 352 | // carManager.Delete(new Car() { CarId = 12, BrandId = 5, ColorId = 1, DailyPrice = 222222, ModelYear = 2000, Description = "araç", CarName = "Megane" }); 353 | // Console.WriteLine("----- Car Deleted... -----"); 354 | //} 355 | 356 | //private static void GetAllCarTest(CarManager carManager) 357 | //{ 358 | // var result = carManager.GetAllCar(); 359 | // if (result.Success) 360 | // { 361 | // Separator(); 362 | // Console.WriteLine("Car List:"); 363 | // foreach (var car in result.Data) 364 | // { 365 | // Console.WriteLine(car.CarName); 366 | // Console.WriteLine("-----Get All Car Tested... -----"); 367 | // } 368 | // } 369 | // else 370 | // { 371 | // Console.WriteLine(result.Message); 372 | // } 373 | //} 374 | 375 | //private static void GetAllBrandTest(BrandManager brandManager) 376 | //{ 377 | // var result = brandManager.GetAllBrand(); 378 | // if (result.Success) 379 | // { 380 | // Separator(); 381 | // Console.WriteLine("Brand List:"); 382 | // foreach (var brand in result.Data) 383 | // { 384 | // Console.WriteLine(brand.BrandName); 385 | // } 386 | // Console.WriteLine("----- Get All Brand Tested... -----"); 387 | // } 388 | //} 389 | 390 | //private static void GetAllColorTest(ColorManager colorManager) 391 | //{ 392 | // var result = colorManager.GetAllColor(); 393 | // if (result.Success) 394 | // { 395 | // Separator(); 396 | // Console.WriteLine("Color List:"); 397 | // foreach (var color in result.Data) 398 | // { 399 | // Console.WriteLine(color.ColorName); 400 | // } 401 | // Console.WriteLine("----- Get All Color Tested... -----"); 402 | // } 403 | // else 404 | // { 405 | // Console.WriteLine(result.Message); 406 | // } 407 | //} 408 | 409 | //private static void GetCarDetailsTest(CarManager carManager) 410 | //{ 411 | // var result = carManager.GetCarDetails(); 412 | // if (result.Success) 413 | // { 414 | // Separator(); 415 | // Console.WriteLine("Car Details List:"); 416 | // foreach (var car in result.Data) 417 | // { 418 | // Console.WriteLine(car.ColorName + " renk " + car.ModelYear + " Model " + car.BrandName + " " 419 | // + car.CarName + ", fiyatı: " + car.DailyPrice + " TL/Gün" + "Açıklama: " + car.Description); 420 | // } 421 | // Console.WriteLine("----- Get Car Details Tested... -----"); 422 | // } 423 | // else 424 | // { 425 | // Console.WriteLine(result.Message); 426 | // } 427 | //} 428 | //private static void GetCustomerDetailsTest(CustomerManager customerManager) 429 | //{ 430 | // var result = customerManager.GetCustomerDetails(); 431 | // if (result.Success) 432 | // { 433 | // Separator(); 434 | // Console.WriteLine("Customer Details List:"); 435 | // foreach (var customer in result.Data) 436 | // { 437 | // Console.WriteLine("firs name: " + customer.FirstName + ", Last name: " + customer.LastName 438 | // + ", Email: " + customer.Email + ", Password: " + customer.Password 439 | // + ", CompanyName: " + customer.CompanyName + "."); 440 | // } 441 | // Console.WriteLine("----- Get Customer Details Tested... -----"); 442 | // } 443 | // else 444 | // { 445 | // Console.WriteLine(result.Message); 446 | // } 447 | //} 448 | //private static void GetRentalDetailsTest(RentalManager rentalManager) 449 | //{ 450 | // var result = rentalManager.GetRentalDetails(); 451 | // if (result.Success) 452 | // { 453 | // Separator(); 454 | // Console.WriteLine("Rental Details List:"); 455 | // foreach (var rental in result.Data) 456 | // { 457 | // Console.WriteLine("Car Id: " + rental.CarId + ", Model year: " + rental.ModelYear 458 | // + ", Car brand: " + rental.BrandName + ", Renk : " + rental.ColorName + ", Car name: " 459 | // + rental.CarName + ", Fiyat: " + rental.DailyPrice + ", \n" + "Customer name: " 460 | // + rental.CustomerName + ", Email: " 461 | // + rental.Email + ", Company name: " + rental.CompanyName + ", \n" + "Rent date: " 462 | // + rental.RentDate + ", Return date: " + ReturnDateFix(rental.ReturnDate.ToString())); 463 | // } 464 | // Console.WriteLine("----- Get Rental Details Tested... -----"); 465 | // } 466 | // else 467 | // { 468 | // Console.WriteLine(result.Message); 469 | // } 470 | //} 471 | 472 | //private static void Separator() 473 | //{ 474 | // Console.WriteLine("--------------------------------------------------"); 475 | //} 476 | 477 | } 478 | } 479 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Caching/CacheAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.CrossCuttingConcerns.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.Linq; 9 | using System.Text; 10 | 11 | namespace Core.Aspects.Autofac.Caching 12 | { 13 | public class CacheAspect : MethodInterception 14 | { 15 | private int _duration; 16 | private 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 | 29 | var key = $"{methodName}({string.Join(",", arguments.Select(x => x?.ToString() ?? ""))})"; 30 | 31 | if (_cacheManager.IsAdd(key)) 32 | { 33 | invocation.ReturnValue = _cacheManager.Get(key); 34 | return; 35 | } 36 | 37 | invocation.Proceed(); 38 | _cacheManager.Add(key, invocation.ReturnValue, _duration); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Caching/CacheRemoveAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.CrossCuttingConcerns.Caching; 3 | using Core.Utilities.Interceptors; 4 | using Core.Utilities.IoC; 5 | using Microsoft.Extensions.DependencyInjection; 6 | 7 | namespace Core.Aspects.Autofac.Caching 8 | { 9 | public class CacheRemoveAspect : MethodInterception 10 | { 11 | private string _pattern; 12 | 13 | private ICacheManager _cacheManager; 14 | 15 | public CacheRemoveAspect(string pattern) 16 | { 17 | _pattern = pattern; 18 | 19 | _cacheManager = ServiceTool.ServiceProvider.GetService(); 20 | } 21 | 22 | protected override void OnSuccess(IInvocation invocation) 23 | { 24 | _cacheManager.RemoveByPattern(_pattern); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Exception/ExceptionLogAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.CrossCuttingConcerns.Logging; 3 | using Core.CrossCuttingConcerns.Logging.Log4Net; 4 | using Core.Utilities.Interceptors; 5 | using Core.Utilities.Messages; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | 10 | namespace Core.Aspects.Autofac.Exception 11 | { 12 | public class ExceptionLogAspect : MethodInterception 13 | { 14 | private LoggerServiceBase _loggerServiceBase; 15 | 16 | public ExceptionLogAspect(Type loggerService) 17 | { 18 | if (loggerService.BaseType != typeof(LoggerServiceBase)) 19 | { 20 | throw new System.Exception(AspectMessages.WrongLoggerType); 21 | } 22 | 23 | _loggerServiceBase = (LoggerServiceBase)Activator.CreateInstance(loggerService); 24 | } 25 | protected override void OnException(IInvocation invocation, System.Exception e) 26 | { 27 | LogDetailWithException logDetailWithException = GetLogDetail(invocation); 28 | 29 | logDetailWithException.ExceptionMessage = e.Message; 30 | 31 | _loggerServiceBase.Error(logDetailWithException); 32 | } 33 | 34 | private LogDetailWithException GetLogDetail(IInvocation invocation) 35 | { 36 | var logParameters = new List(); 37 | 38 | for (int i = 0; i < invocation.Arguments.Length; i++) 39 | { 40 | logParameters.Add(new LogParameter 41 | { 42 | Name = invocation.GetConcreteMethod().GetParameters()[i].Name, 43 | Value = invocation.Arguments[i], 44 | Type = invocation.Arguments[i].GetType().Name 45 | }); 46 | } 47 | 48 | var logDetailWithException = new LogDetailWithException 49 | { 50 | MethodName = invocation.Method.Name, 51 | LogParameters = logParameters 52 | }; 53 | 54 | return logDetailWithException; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Logging/LogAspect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Castle.DynamicProxy; 6 | using Core.CrossCuttingConcerns.Logging; 7 | using Core.CrossCuttingConcerns.Logging.Log4Net; 8 | using Core.Utilities.Interceptors; 9 | using Core.Utilities.Messages; 10 | 11 | namespace Core.Aspects.Autofac.Logging 12 | { 13 | public class LogAspect : MethodInterception 14 | { 15 | private LoggerServiceBase _loggerServiceBase; 16 | 17 | public LogAspect(Type loggerService) 18 | { 19 | if (loggerService.BaseType != typeof(LoggerServiceBase)) 20 | { 21 | throw new System.Exception(AspectMessages.WrongLoggerType); 22 | } 23 | 24 | _loggerServiceBase = (LoggerServiceBase)Activator.CreateInstance(loggerService); 25 | } 26 | 27 | protected override void OnBefore(IInvocation invocation) 28 | { 29 | _loggerServiceBase.Info(GetLogDetail(invocation)); 30 | } 31 | 32 | private LogDetail GetLogDetail(IInvocation invocation) 33 | { 34 | var logParameters = new List(); 35 | 36 | for (int i = 0; i < invocation.Arguments.Length; i++) 37 | { 38 | logParameters.Add(new LogParameter 39 | { 40 | Name = invocation.GetConcreteMethod().GetParameters()[i].Name, 41 | Value = invocation.Arguments[i], 42 | Type = invocation.Arguments[i].GetType().Name 43 | }); 44 | } 45 | 46 | var logDetail = new LogDetail 47 | { 48 | MethodName = invocation.Method.Name, 49 | LogParameters = logParameters 50 | }; 51 | 52 | 53 | return logDetail; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /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 int _interval; 15 | 16 | private Stopwatch _stopwatch; 17 | 18 | public PerformanceAspect(int interval) 19 | { 20 | _interval = interval; 21 | _stopwatch = ServiceTool.ServiceProvider.GetService(); 22 | } 23 | 24 | 25 | protected override void OnBefore(IInvocation invocation) 26 | { 27 | _stopwatch.Start(); 28 | } 29 | 30 | protected override void OnAfter(IInvocation invocation) 31 | { 32 | if (_stopwatch.Elapsed.TotalSeconds > _interval) 33 | { 34 | 35 | Debug.WriteLine($"Performance : {invocation.Method.DeclaringType.FullName}.{invocation.Method.Name}-->{_stopwatch.Elapsed.TotalSeconds}"); 36 | } 37 | _stopwatch.Reset(); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Transaction/TransactionScopeAspect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Transactions; 5 | using Castle.DynamicProxy; 6 | using Core.Utilities.Interceptors; 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 | { 16 | try 17 | { 18 | invocation.Proceed(); 19 | 20 | transactionScope.Complete(); 21 | } 22 | catch (System.Exception e) 23 | { 24 | transactionScope.Dispose(); 25 | 26 | throw; 27 | } 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Validation/ValidationAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.CrossCuttingConcerns.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 | public ValidationAspect(Type validatorType) 16 | { 17 | if (!typeof(IValidator).IsAssignableFrom(validatorType)) 18 | { 19 | throw new System.Exception("bu bir doğrulama sınıfı değil"); 20 | } 21 | 22 | _validatorType = validatorType; 23 | } 24 | protected override void OnBefore(IInvocation invocation) 25 | { 26 | var validator = (IValidator)Activator.CreateInstance(_validatorType); 27 | var entityType = _validatorType.BaseType.GetGenericArguments()[0]; 28 | 29 | var entities = invocation.Arguments.Where(t => t.GetType() == entityType); 30 | 31 | foreach (var entity in entities) 32 | { 33 | ValidationTool.Validate(validator, entity); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Core/Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Caching/ICacheManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.CrossCuttingConcerns.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 | 14 | void Remove(string key); 15 | 16 | void RemoveByPattern(string pattern); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/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.CrossCuttingConcerns.Caching.Microsoft 11 | { 12 | public class MemoryCacheManager : ICacheManager 13 | { 14 | //Adapter Pattern 15 | IMemoryCache _memoryCache; 16 | 17 | public MemoryCacheManager() 18 | { 19 | _memoryCache = ServiceTool.ServiceProvider.GetService(); 20 | } 21 | 22 | public void Add(string key, object value, int duration) 23 | { 24 | _memoryCache.Set(key, value, TimeSpan.FromMinutes(duration)); 25 | } 26 | 27 | public T Get(string key) 28 | { 29 | return _memoryCache.Get(key); 30 | } 31 | 32 | public object Get(string key) 33 | { 34 | return _memoryCache.Get(key); 35 | } 36 | 37 | public bool IsAdd(string key) 38 | { 39 | return _memoryCache.TryGetValue(key, out _); 40 | } 41 | 42 | public void Remove(string key) 43 | { 44 | _memoryCache.Remove(key); 45 | } 46 | 47 | public void RemoveByPattern(string pattern) 48 | { 49 | var cacheEntriesCollectionDefinition = typeof(MemoryCache).GetProperty("EntriesCollection", 50 | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); 51 | var cacheEntriesCollection = cacheEntriesCollectionDefinition.GetValue(_memoryCache) as dynamic; 52 | 53 | List cacheCollectionValues = new List(); 54 | 55 | foreach (var cacheItem in cacheEntriesCollection) 56 | { 57 | ICacheEntry cacheItemValue = cacheItem.GetType().GetProperty("Value").GetValue(cacheItem, null); 58 | cacheCollectionValues.Add(cacheItemValue); 59 | } 60 | 61 | var regex = new Regex(pattern, RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase); 62 | 63 | var keysToRemove = cacheCollectionValues.Where(d => regex.IsMatch(d.Key.ToString())).Select(d => d.Key).ToList(); 64 | 65 | foreach (var key in keysToRemove) 66 | { 67 | _memoryCache.Remove(key); 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/Layouts/JsonLayout.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | using log4net.Core; 6 | using log4net.Layout; 7 | using Newtonsoft.Json; 8 | 9 | namespace Core.CrossCuttingConcerns.Logging.Log4Net.Layouts 10 | { 11 | public class JsonLayout : LayoutSkeleton 12 | { 13 | public override void ActivateOptions() 14 | { 15 | 16 | } 17 | 18 | public override void Format(TextWriter writer, LoggingEvent loggingEvent) 19 | { 20 | var logEvent = new SerializableLogEvent(loggingEvent); 21 | 22 | var json = JsonConvert.SerializeObject(logEvent, Formatting.Indented); 23 | 24 | writer.WriteLine(json); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/LoggerServiceBase.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using log4net.Repository; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Reflection; 7 | using System.Text; 8 | using System.Xml; 9 | 10 | namespace Core.CrossCuttingConcerns.Logging.Log4Net 11 | { 12 | public class LoggerServiceBase 13 | { 14 | private ILog _log; 15 | public LoggerServiceBase(string name) 16 | { 17 | XmlDocument xmlDocument = new XmlDocument(); 18 | 19 | xmlDocument.Load(File.OpenRead("log4net.config")); 20 | 21 | ILoggerRepository loggerRepository = LogManager.CreateRepository(Assembly.GetEntryAssembly(), 22 | typeof(log4net.Repository.Hierarchy.Hierarchy)); 23 | 24 | log4net.Config.XmlConfigurator.Configure(loggerRepository, xmlDocument["log4net"]); 25 | 26 | _log = LogManager.GetLogger(loggerRepository.Name, name); 27 | 28 | 29 | } 30 | 31 | public bool IsInfoEnabled => _log.IsInfoEnabled; 32 | public bool IsDebugEnabled => _log.IsDebugEnabled; 33 | public bool IsWarnEnabled => _log.IsWarnEnabled; 34 | public bool IsFatalEnabled => _log.IsFatalEnabled; 35 | public bool IsErrorEnabled => _log.IsErrorEnabled; 36 | 37 | public void Info(object logMessage) 38 | { 39 | if (IsInfoEnabled) 40 | _log.Info(logMessage); 41 | } 42 | 43 | public void Debug(object logMessage) 44 | { 45 | if (IsDebugEnabled) 46 | _log.Debug(logMessage); 47 | } 48 | 49 | public void Warn(object logMessage) 50 | { 51 | if (IsWarnEnabled) 52 | _log.Warn(logMessage); 53 | } 54 | 55 | public void Fatal(object logMessage) 56 | { 57 | if (IsFatalEnabled) 58 | _log.Fatal(logMessage); 59 | } 60 | 61 | public void Error(object logMessage) 62 | { 63 | if (IsErrorEnabled) 64 | _log.Error(logMessage); 65 | } 66 | 67 | 68 | } 69 | } -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/Loggers/DatabaseLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.CrossCuttingConcerns.Logging.Log4Net.Loggers 6 | { 7 | public class DatabaseLogger : LoggerServiceBase 8 | { 9 | public DatabaseLogger() : base("DatabaseLogger") 10 | { 11 | 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/Loggers/FileLogger.cs: -------------------------------------------------------------------------------- 1 | namespace Core.CrossCuttingConcerns.Logging.Log4Net.Loggers 2 | { 3 | public class FileLogger : LoggerServiceBase 4 | { 5 | public FileLogger() : base("JsonFileLogger") 6 | { 7 | // 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/SerializableLogEvent.cs: -------------------------------------------------------------------------------- 1 | using log4net.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.CrossCuttingConcerns.Logging.Log4Net 7 | { 8 | [Serializable] 9 | public class SerializableLogEvent 10 | { 11 | private LoggingEvent _loggingEvent; 12 | 13 | public SerializableLogEvent(LoggingEvent loggingEvent) 14 | { 15 | 16 | _loggingEvent = loggingEvent; 17 | } 18 | 19 | 20 | public object Message => _loggingEvent.MessageObject; 21 | } 22 | } -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/LogDetail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.CrossCuttingConcerns.Logging 6 | { 7 | public class LogDetail 8 | { 9 | public string MethodName { get; set; } 10 | 11 | public List LogParameters { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/LogDetailWithException.cs: -------------------------------------------------------------------------------- 1 | namespace Core.CrossCuttingConcerns.Logging 2 | { 3 | public class LogDetailWithException : LogDetail 4 | { 5 | public string ExceptionMessage { get; set; } 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/LogParameter.cs: -------------------------------------------------------------------------------- 1 | namespace Core.CrossCuttingConcerns.Logging 2 | { 3 | public class LogParameter 4 | { 5 | public string Name { get; set; } 6 | 7 | public object Value { get; set; } 8 | 9 | public string Type { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Validation/ValidationTool.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.CrossCuttingConcerns.Validation 7 | { 8 | public static 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 | 15 | if (!result.IsValid) 16 | { 17 | throw new ValidationException(result.Errors); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Core/DataAccess/EntityFramework/EfEntityRepositoryBase.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using Microsoft.EntityFrameworkCore; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace Core.DataAccess.EntityFramework 10 | { 11 | public class EfEntityRepositoryBase : IEntityRepository 12 | where TEntity : class, IEntity, new() 13 | where TContext : DbContext, new() 14 | { 15 | public void Add(TEntity entity) 16 | { 17 | using (TContext context = new TContext()) 18 | { 19 | var addedEntity = context.Entry(entity); 20 | addedEntity.State = EntityState.Added; 21 | context.SaveChanges(); 22 | } 23 | } 24 | 25 | public void Delete(TEntity entity) 26 | { 27 | using (TContext context = new TContext()) 28 | { 29 | var deletedEntity = context.Entry(entity); 30 | deletedEntity.State = EntityState.Deleted; 31 | context.SaveChanges(); 32 | } 33 | } 34 | 35 | public TEntity Get(Expression> filter) 36 | { 37 | using (TContext context = new TContext()) 38 | { 39 | var result = context.Set().SingleOrDefault(filter); 40 | return result; 41 | } 42 | } 43 | 44 | public List GetAll(Expression> filter = null) 45 | { 46 | using (TContext context = new TContext()) 47 | { 48 | return filter == null ? context.Set().ToList() : context.Set().Where(filter).ToList(); 49 | } 50 | } 51 | 52 | public void Update(TEntity entity) 53 | { 54 | using (TContext context = new TContext()) 55 | { 56 | var updatedEntity = context.Entry(entity); 57 | updatedEntity.State = EntityState.Modified; 58 | context.SaveChanges(); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Core/DataAccess/IEntityRepository.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq.Expressions; 5 | 6 | namespace Core.DataAccess 7 | { 8 | public interface IEntityRepository where T : class, IEntity, new() 9 | { 10 | List GetAll(Expression> filter = null) ; 11 | T Get(Expression> filter) ; 12 | void Add(T entity) ; 13 | void Update(T entity) ; 14 | void Delete(T entity) ; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Core/DependencyResolvers/CoreModule.cs: -------------------------------------------------------------------------------- 1 | using Core.CrossCuttingConcerns.Caching; 2 | using Core.CrossCuttingConcerns.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 serviceCollection) 16 | { 17 | serviceCollection.AddMemoryCache(); 18 | serviceCollection.AddSingleton(); 19 | serviceCollection.AddSingleton(); 20 | 21 | serviceCollection.AddSingleton(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/OperationClaim.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities.Concrete 6 | { 7 | public class OperationClaim : IEntity 8 | { 9 | public int Id { get; set; } 10 | public string Name { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/Payment/FakeCreditCardModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities.Concrete.Payment 6 | { 7 | public class FakeCreditCardModel : IPaymentModel 8 | { 9 | public string CardHolderName { get; set; } 10 | public int ExpirationMonth { get; set; } 11 | public int ExpirationYear { get; set; } 12 | public string CardNumber { get; set; } 13 | public string Cvv { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/Payment/IPaymentModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities.Concrete.Payment 6 | { 7 | public interface IPaymentModel 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/User.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities.Concrete 6 | { 7 | public class User : IEntity 8 | { 9 | public int Id { get; set; } 10 | public string FirstName { get; set; } 11 | public string LastName { get; set; } 12 | public string Email { get; set; } 13 | public byte[] PasswordSalt { get; set; } 14 | public byte[] PasswordHash { get; set; } 15 | public bool Status { get; set; } 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/UserOperationClaim.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities.Concrete 6 | { 7 | public class UserOperationClaim : IEntity 8 | { 9 | public int Id { get; set; } 10 | public int UserId { get; set; } 11 | public int OperationClaimId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/Entities/IDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities 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.Entities 6 | { 7 | public interface IEntity 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Core/Extensions/ClaimExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IdentityModel.Tokens.Jwt; 3 | using System.Linq; 4 | using System.Security.Claims; 5 | 6 | namespace Core.Extensions 7 | { 8 | public static class ClaimExtensions 9 | { 10 | public static void AddEmail(this ICollection claims, string email) 11 | { 12 | claims.Add(new Claim(JwtRegisteredClaimNames.Email, email)); 13 | } 14 | 15 | public static void AddName(this ICollection claims, string name) 16 | { 17 | claims.Add(new Claim(ClaimTypes.Name, name)); 18 | } 19 | 20 | public static void AddNameIdentifier(this ICollection claims, string nameIdentifier) 21 | { 22 | claims.Add(new Claim(ClaimTypes.NameIdentifier, nameIdentifier)); 23 | } 24 | 25 | public static void AddRoles(this ICollection claims, string[] roles) 26 | { 27 | roles.ToList().ForEach(role => claims.Add(new Claim(ClaimTypes.Role, role))); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Core/Extensions/ClaimsPrincipalExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Security.Claims; 4 | 5 | namespace Core.Extensions 6 | { 7 | public static class ClaimsPrincipalExtensions 8 | { 9 | public static List Claims(this ClaimsPrincipal claimsPrincipal, string claimType) 10 | { 11 | var result = claimsPrincipal?.FindAll(claimType)?.Select(x => x.Value).ToList(); 12 | return result; 13 | } 14 | 15 | public static List ClaimRoles(this ClaimsPrincipal claimsPrincipal) 16 | { 17 | return claimsPrincipal?.Claims(ClaimTypes.Role); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Core/Extensions/ErrorDetails.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation.Results; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Core.Extensions 8 | { 9 | public class ErrorDetails 10 | { 11 | public string Message { get; set; } 12 | public int StatusCode { get; set; } 13 | public override string ToString() 14 | { 15 | return JsonConvert.SerializeObject(this); 16 | } 17 | } 18 | public class ValidationErrorDetails : ErrorDetails 19 | { 20 | public IEnumerable Errors { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Core/Extensions/ExceptionMiddleware.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using FluentValidation.Results; 3 | using Microsoft.AspNetCore.Http; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using System.Net; 8 | using System.Threading.Tasks; 9 | 10 | namespace Core.Extensions 11 | { 12 | public class ExceptionMiddleware 13 | { 14 | private RequestDelegate _next; 15 | 16 | public ExceptionMiddleware(RequestDelegate next) 17 | { 18 | _next = next; 19 | } 20 | 21 | public async Task InvokeAsync(HttpContext httpContext) 22 | { 23 | try 24 | { 25 | await _next(httpContext); 26 | } 27 | catch (Exception e) 28 | { 29 | await HandleExceptionAsync(httpContext, e); 30 | } 31 | } 32 | 33 | private Task HandleExceptionAsync(HttpContext httpContext, Exception e) 34 | { 35 | httpContext.Response.ContentType = "application/json"; 36 | httpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; 37 | 38 | string message = "Internal Server Error"; 39 | IEnumerable errors; 40 | if (e.GetType() == typeof(ValidationException)) 41 | { 42 | message = e.Message; 43 | errors = ((ValidationException)e).Errors; 44 | httpContext.Response.StatusCode = 400; 45 | 46 | return httpContext.Response.WriteAsync(new ValidationErrorDetails 47 | { 48 | StatusCode = 400, 49 | Message = message, 50 | Errors = errors 51 | }.ToString()); 52 | 53 | } 54 | 55 | return httpContext.Response.WriteAsync(new ErrorDetails 56 | { 57 | StatusCode = httpContext.Response.StatusCode, 58 | Message = message 59 | }.ToString()); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Core/Extensions/ExceptionMiddlewareExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Extensions 7 | { 8 | public static class ExceptionMiddlewareExtensions 9 | { 10 | public static void ConfigureCustomExceptionMiddleware(this IApplicationBuilder app) 11 | { 12 | app.UseMiddleware(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Core/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.Extensions 8 | { 9 | public static class ServiceCollectionExtensions 10 | { 11 | public static IServiceCollection AddDependencyResolvers 12 | (this IServiceCollection serviceCollection, ICoreModule[] modules) 13 | { 14 | foreach (var module in modules) 15 | { 16 | 17 | module.Load(serviceCollection); 18 | } 19 | 20 | return ServiceTool.Create(serviceCollection); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | { 16 | return logic; 17 | } 18 | } 19 | 20 | return null; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/AspectInterceptorSelector.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.Aspects.Autofac.Exception; 3 | using Core.CrossCuttingConcerns.Logging.Log4Net.Loggers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Text; 9 | 10 | namespace Core.Utilities.Interceptors 11 | { 12 | 13 | public class AspectInterceptorSelector : IInterceptorSelector 14 | { 15 | public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors) 16 | { 17 | var classAttributes = type.GetCustomAttributes 18 | (true).ToList(); 19 | var methodAttributes = type.GetMethod(method.Name) 20 | .GetCustomAttributes(true); 21 | classAttributes.AddRange(methodAttributes); 22 | 23 | classAttributes.Add(new ExceptionLogAspect(typeof(FileLogger))); 24 | 25 | return classAttributes.OrderBy(x => x.Priority).ToArray(); 26 | } 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/MethodInterception.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using System; 3 | 4 | namespace Core.Utilities.Interceptors 5 | { 6 | public abstract class MethodInterception : MethodInterceptionBaseAttribute 7 | { 8 | protected virtual void OnBefore(IInvocation invocation) { } 9 | protected virtual void OnAfter(IInvocation invocation) { } 10 | protected virtual void OnException(IInvocation invocation, System.Exception e) { } 11 | protected virtual void OnSuccess(IInvocation invocation) { } 12 | public override void Intercept(IInvocation invocation) 13 | { 14 | var isSuccess = true; 15 | OnBefore(invocation); 16 | try 17 | { 18 | invocation.Proceed(); 19 | } 20 | catch (Exception e) 21 | { 22 | isSuccess = false; 23 | OnException(invocation, e); 24 | throw; 25 | } 26 | finally 27 | { 28 | if (isSuccess) 29 | { 30 | OnSuccess(invocation); 31 | } 32 | } 33 | OnAfter(invocation); 34 | } 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/MethodInterceptionBaseAttribute.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using System; 3 | 4 | namespace Core.Utilities.Interceptors 5 | { 6 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] 7 | public abstract class MethodInterceptionBaseAttribute : Attribute, IInterceptor 8 | { 9 | public int Priority { get; set; } 10 | 11 | public virtual void Intercept(IInvocation invocation) 12 | { 13 | 14 | } 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /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 serviceCollection); 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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/Utilities/Messages/AspectMessages.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Messages 6 | { 7 | public static class AspectMessages 8 | { 9 | public static string WrongValidationType = "Wrong Validation Type"; 10 | 11 | public static string WrongLoggerType = "Wrong Logger Type"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/Utilities/Operations/FileOperation.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Microsoft.AspNetCore.Http; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Text; 7 | 8 | namespace Core.Utilities.Operations 9 | { 10 | public class FileOperations 11 | { 12 | //Guid Hakkında Not: 13 | //Guid.NewGuid().ToString() yazarsak sonuç : 00000000-0000-0000-0000-000000000000 şeklinde olur. 14 | //Guid.NewGuid().ToString("N") yazarsak sonuç : 00000000000000000000000000000000 şeklinde olur. 15 | //yani - (tire)'leri kaldırarak yazıyor. 16 | //bunun ToString("D"),ToString("B"),ToString("P"),ToString("X") gibi farklı formatlarda kullanımları var. 17 | //ToString("D") ile ToString() aynı aslında, 18 | //("B"): sonucu { } içine yazıyor, ("P"): sonucu ( ) içine yazıyor. 19 | //("X") ise {0x00000000, 0x0000, 0x0000 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}} gibi bi sonuç dönderiyor. 20 | 21 | private static string _wwwRoot = "wwwroot"; 22 | 23 | public static string SaveImageFile(string fileName, IFormFile extension) 24 | { 25 | string resimUzantisi = Path.GetExtension(extension.FileName); 26 | string yeniResimAdi = string.Format("{0:D}{1}", Guid.NewGuid(), resimUzantisi); 27 | string imageKlasoru = Path.Combine(_wwwRoot, fileName); 28 | string tamResimYolu = Path.Combine(imageKlasoru, yeniResimAdi); 29 | string webResimYolu = string.Format("/" + fileName + "/{0}", yeniResimAdi); 30 | if (!Directory.Exists(imageKlasoru)) 31 | Directory.CreateDirectory(imageKlasoru); 32 | 33 | using (var fileStream = File.Create(tamResimYolu)) 34 | { 35 | extension.CopyTo(fileStream); 36 | fileStream.Flush(); 37 | } 38 | return webResimYolu; 39 | } 40 | 41 | public static bool DeleteImageFile(string fileName) 42 | { 43 | string fullPath = Path.Combine(fileName); 44 | if (File.Exists(_wwwRoot + fullPath)) 45 | { 46 | File.Delete(_wwwRoot + fullPath); 47 | return true; 48 | } 49 | return false; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /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, string message):base(success,message) 10 | { 11 | Data = data; 12 | } 13 | 14 | public DataResult(T data, bool success):base(success) 15 | { 16 | Data = data; 17 | } 18 | 19 | public T Data { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /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(T data, string message) : base(data, false, message) 10 | { 11 | 12 | } 13 | public ErrorDataResult(T data) : base(data, false) 14 | { 15 | 16 | } 17 | public ErrorDataResult(string message) : base(default, false, message) 18 | { 19 | 20 | } 21 | public ErrorDataResult() : base(default, false) 22 | { 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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 8 | { 9 | public ErrorResult(string message) : base(false, message) 10 | { 11 | 12 | } 13 | public ErrorResult() : base(false) 14 | { 15 | 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /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 | } 14 | -------------------------------------------------------------------------------- /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, string message):this(success) 10 | { 11 | Message = message; 12 | } 13 | public Result(bool success) 14 | { 15 | Success = success; 16 | } 17 | 18 | public bool Success { get; } 19 | 20 | public string Message { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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(T data, string message) : base(data, true, message) 10 | { 11 | 12 | } 13 | public SuccessDataResult(T data) : base(data, true) 14 | { 15 | 16 | } 17 | public SuccessDataResult(string message):base(default,true,message) 18 | { 19 | 20 | } 21 | public SuccessDataResult():base(default,true) 22 | { 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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 8 | { 9 | public SuccessResult(string message):base(true,message) 10 | { 11 | 12 | } 13 | public SuccessResult() : base(true) 14 | { 15 | 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | //sha 512 algoritması kullanılıyor. 12 | using (var hmac = new System.Security.Cryptography.HMACSHA512()) 13 | { 14 | passwordSalt = hmac.Key; 15 | passwordHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(password)); 16 | } 17 | } 18 | 19 | public static bool VerifyPasswordHash(string password, byte[] passwordHash, byte[] passwordSalt) 20 | { 21 | using (var hmac = new System.Security.Cryptography.HMACSHA512(passwordSalt)) 22 | { 23 | var computedHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(password)); 24 | for (int i = 0; i < computedHash.Length; i++) 25 | { 26 | if (computedHash[i] != passwordHash[i]) 27 | { 28 | return false; 29 | } 30 | } 31 | return true; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Core/Utilities/Security/JWT/JwtHelper.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.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 | private DateTime _accessTokenExpiration; 20 | public JwtHelper(IConfiguration configuration) 21 | { 22 | Configuration = configuration; 23 | _tokenOptions = Configuration.GetSection("TokenOptions").Get(); 24 | 25 | } 26 | public AccessToken CreateToken(User user, List operationClaims) 27 | { 28 | _accessTokenExpiration = DateTime.Now.AddMinutes(_tokenOptions.AccessTokenExpiration); 29 | var securityKey = SecurityKeyHelper.CreateSecurityKey(_tokenOptions.SecurityKey); 30 | var signingCredentials = SigningCredentialsHelper.CreateSigningCredentials(securityKey); 31 | var jwt = CreateJwtSecurityToken(_tokenOptions, user, signingCredentials, operationClaims); 32 | var jwtSecurityTokenHandler = new JwtSecurityTokenHandler(); 33 | var token = jwtSecurityTokenHandler.WriteToken(jwt); 34 | 35 | return new AccessToken 36 | { 37 | Token = token, 38 | Expiration = _accessTokenExpiration 39 | }; 40 | 41 | } 42 | 43 | public JwtSecurityToken CreateJwtSecurityToken(TokenOptions tokenOptions, User user, 44 | SigningCredentials signingCredentials, List operationClaims) 45 | { 46 | var jwt = new JwtSecurityToken( 47 | issuer: tokenOptions.Issuer, 48 | audience: tokenOptions.Audience, 49 | expires: _accessTokenExpiration, 50 | notBefore: DateTime.Now, 51 | claims: SetClaims(user, operationClaims), 52 | signingCredentials: signingCredentials 53 | ); 54 | return jwt; 55 | } 56 | 57 | private IEnumerable SetClaims(User user, List operationClaims) 58 | { 59 | var claims = new List(); 60 | claims.AddNameIdentifier(user.Id.ToString()); 61 | claims.AddEmail(user.Email); 62 | claims.AddName($"{user.FirstName} {user.LastName}"); 63 | claims.AddRoles(operationClaims.Select(c => c.Name).ToArray()); 64 | 65 | return claims; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IBrandDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 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 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICarDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 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 DataAccess.Abstract 10 | { 11 | public interface ICarDal : IEntityRepository 12 | { 13 | List GetCarDetails(Expression> filter = null); 14 | List GetCarDetailById(int carId); 15 | List GetCarDetailsByBrandAndColor(int brandId, int colorId); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICarImageDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 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/IColorDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 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 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICustomerDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 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 ICustomerDal : IEntityRepository 11 | { 12 | List GetCustomerDetails(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IRentalDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 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 IRentalDal : IEntityRepository 11 | { 12 | List GetRentalDetails(); 13 | List GetRentalDetailsById(int id); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 2 | using Core.Entities.Concrete; 3 | using System.Collections.Generic; 4 | 5 | namespace DataAccess.Abstract 6 | { 7 | public interface IUserDal : IEntityRepository 8 | { 9 | List GetClaims(User user); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DataAccess/Concrate/EntityFramework/EfBrandDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrate.EntityFramework 10 | { 11 | public class EfBrandDal : EfEntityRepositoryBase, IBrandDal 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DataAccess/Concrate/EntityFramework/EfCarDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using Entities.DTOs; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Linq.Expressions; 9 | 10 | namespace DataAccess.Concrate.EntityFramework 11 | { 12 | public class EfCarDal : EfEntityRepositoryBase, ICarDal 13 | { 14 | public List GetCarDetails(Expression> filter = null) 15 | { 16 | using (RentACarContext context = new RentACarContext()) 17 | { 18 | var result = (from car in filter == null ? context.Cars : context.Cars.Where(filter) 19 | join c in context.Colors on car.ColorId equals c.ColorId 20 | join d in context.Brands on car.BrandId equals d.BrandId 21 | join im in context.CarImages on car.CarId equals im.CarId 22 | select new CarDetailDto 23 | { 24 | CarId = car.CarId, 25 | CarName = car.CarName, 26 | BrandName = d.BrandName, 27 | ColorName = c.ColorName, 28 | DailyPrice = car.DailyPrice, 29 | Description = car.Description, 30 | ModelYear = car.ModelYear, 31 | Date = im.Date, 32 | ImagePath = im.ImagePath, 33 | ImageId = im.Id, 34 | MinFindeksScore = car.MinFindeksScore 35 | }).ToList(); 36 | return result.GroupBy(car => car.CarId).Select(car => car.FirstOrDefault()).ToList(); 37 | } 38 | } 39 | 40 | public List GetCarDetailById(int carId) 41 | { 42 | using (RentACarContext context = new RentACarContext()) 43 | { 44 | var result = from car in context.Cars 45 | join c in context.Colors on car.ColorId equals c.ColorId 46 | join d in context.Brands on car.BrandId equals d.BrandId 47 | join im in context.CarImages on car.CarId equals im.CarId 48 | where car.CarId == carId 49 | select new CarDetailDto 50 | { 51 | CarId = car.CarId, 52 | CarName = car.CarName, 53 | BrandId = car.BrandId, 54 | BrandName = d.BrandName, 55 | ColorId = car.ColorId, 56 | ColorName = c.ColorName, 57 | DailyPrice = car.DailyPrice, 58 | Description = car.Description, 59 | ModelYear = car.ModelYear, 60 | Date = im.Date, 61 | ImagePath = im.ImagePath, 62 | ImageId = im.Id, 63 | MinFindeksScore = car.MinFindeksScore 64 | }; 65 | return result.ToList(); 66 | } 67 | } 68 | 69 | public List GetCarDetailsByBrandAndColor(int brandId, int colorId) 70 | { 71 | using (RentACarContext context = new RentACarContext()) 72 | { 73 | var result = from car in context.Cars.Where 74 | (car => car.BrandId == brandId && car.ColorId == colorId) 75 | join brand in context.Brands on car.BrandId equals brand.BrandId 76 | join color in context.Colors on car.ColorId equals color.ColorId 77 | 78 | select new CarDetailDto 79 | { 80 | CarId = car.CarId, 81 | BrandName = brand.BrandName, 82 | ColorName = color.ColorName, 83 | DailyPrice = car.DailyPrice, 84 | ModelYear = car.ModelYear, 85 | MinFindeksScore = car.MinFindeksScore, 86 | ImagePath = (from carImage in context.CarImages 87 | where (carImage.CarId == car.CarId) 88 | select carImage).FirstOrDefault().ImagePath 89 | }; 90 | return result.ToList(); 91 | } 92 | } 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /DataAccess/Concrate/EntityFramework/EfCarImageDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrate.EntityFramework 10 | { 11 | public class EfCarImageDal : EfEntityRepositoryBase, ICarImageDal 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DataAccess/Concrate/EntityFramework/EfColorDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrate.EntityFramework 10 | { 11 | public class EfColorDal : EfEntityRepositoryBase, IColorDal 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DataAccess/Concrate/EntityFramework/EfCustomerDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using Entities.DTOs; 5 | using Microsoft.EntityFrameworkCore; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Linq.Expressions; 10 | using System.Text; 11 | 12 | namespace DataAccess.Concrate.EntityFramework 13 | { 14 | public class EfCustomerDal : EfEntityRepositoryBase, ICustomerDal 15 | { 16 | public List GetCustomerDetails() 17 | { 18 | using (RentACarContext context = new RentACarContext()) 19 | { 20 | var result = from cus in context.Customers 21 | join u in context.Users on cus.UserId equals u.Id 22 | select new CustomerDetailDto 23 | { 24 | UserId = cus.Id, 25 | FirstName = u.FirstName, 26 | LastName = u.LastName, 27 | Email = u.Email, 28 | CompanyName = cus.CompanyName 29 | }; 30 | return result.ToList(); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /DataAccess/Concrate/EntityFramework/EfRentalDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using Entities.DTOs; 5 | using Microsoft.EntityFrameworkCore; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | 10 | namespace DataAccess.Concrate.EntityFramework 11 | { 12 | public class EfRentalDal : EfEntityRepositoryBase, IRentalDal 13 | { 14 | public List GetRentalDetailsById(int id) 15 | { 16 | using (RentACarContext context = new RentACarContext()) 17 | { 18 | var result = 19 | from r in context.Rentals.Where(c => c.CarId == id) 20 | join c in context.Cars on r.CarId equals c.CarId 21 | join cu in context.Customers on r.CustomerId equals cu.Id 22 | join b in context.Brands on c.BrandId equals b.BrandId 23 | join co in context.Colors on c.ColorId equals co.ColorId 24 | join u in context.Users on cu.UserId equals u.Id 25 | join user in context.Users on cu.UserId equals user.Id 26 | select new RentalDetailDto 27 | { 28 | CarName = c.CarName, 29 | 30 | CarId = c.CarId, 31 | BrandName = b.BrandName, 32 | ColorName = co.ColorName, 33 | 34 | CustomerName = cu.CompanyName, 35 | UserName = $"{u.FirstName} {u.LastName}", 36 | RentDate = r.RentDate, 37 | ReturnDate = r.ReturnDate, 38 | DailyPrice = c.DailyPrice, 39 | Description = c.Description, 40 | Email = user.Email, 41 | ModelYear = c.ModelYear 42 | }; 43 | return result.ToList(); 44 | } 45 | } 46 | public List GetRentalDetails() 47 | { 48 | using (RentACarContext context = new RentACarContext()) 49 | { 50 | var result = from r in context.Rentals 51 | join car in context.Cars on r.CarId equals car.CarId 52 | join brand in context.Brands on car.BrandId equals brand.BrandId 53 | join color in context.Colors on car.ColorId equals color.ColorId 54 | join customer in context.Customers on r.CustomerId equals customer.Id 55 | join user in context.Users on customer.UserId equals user.Id 56 | 57 | select new RentalDetailDto 58 | { 59 | Id=r.Id, 60 | CarId = car.CarId, 61 | CarName = car.CarName, 62 | BrandName = brand.BrandName, 63 | ColorName = color.ColorName, 64 | DailyPrice = car.DailyPrice, 65 | ModelYear = car.ModelYear, 66 | Description = car.Description, 67 | CustomerName = user.FirstName +" "+ user.LastName, 68 | Email = user.Email, 69 | RentDate = r.RentDate, 70 | ReturnDate = r.ReturnDate 71 | }; 72 | return result.ToList(); 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /DataAccess/Concrate/EntityFramework/EfUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using Core.Entities.Concrete; 3 | using DataAccess.Abstract; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrate.EntityFramework 10 | { 11 | public class EfUserDal : EfEntityRepositoryBase, IUserDal 12 | { 13 | public List GetClaims(User user) 14 | { 15 | using (var context = new RentACarContext()) 16 | { 17 | var result = from operationClaim in context.OperationClaims 18 | join userOperationClaim in context.UserOperationClaims 19 | on operationClaim.Id equals userOperationClaim.OperationClaimId 20 | where userOperationClaim.UserId == user.Id 21 | select new OperationClaim { Id = operationClaim.Id, Name = operationClaim.Name }; 22 | return result.ToList(); 23 | 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DataAccess/Concrate/EntityFramework/RentACarContext.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Entities.Concrete; 3 | using Microsoft.EntityFrameworkCore; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrate.EntityFramework 9 | { 10 | public class RentACarContext : DbContext 11 | { 12 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 13 | { 14 | //Integrated Security=True ile Trusted_Connection=true aynı şeylerdir. 15 | optionsBuilder.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=RentACar;Trusted_Connection=true") ; 16 | } 17 | public DbSet Cars { get; set; } 18 | public DbSet Brands { get; set; } 19 | public DbSet Colors { get; set; } 20 | public DbSet Customers { get; set; } 21 | public DbSet Rentals { get; set; } 22 | public DbSet CarImages { get; set; } 23 | public DbSet OperationClaims { get; set; } 24 | public DbSet Users { get; set; } 25 | public DbSet UserOperationClaims { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /DataAccess/Concrate/InMemory/InMemoryCarDal.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.Concrate.InMemory 11 | { 12 | //GetById, GetAll, Add, Update, Delete 13 | public class InMemoryCarDal : ICarDal 14 | { 15 | List _cars; 16 | public InMemoryCarDal() 17 | { 18 | _cars = new List { 19 | new Car{CarId=1, BrandId=1, ColorId=1, DailyPrice=250000, ModelYear=2021, Description="an example"}, 20 | new Car{CarId=2, BrandId=2, ColorId=4, DailyPrice=130000, ModelYear=2021, Description="an example2"}, 21 | new Car{CarId=3, BrandId=1, ColorId=3, DailyPrice=150000, ModelYear=2020, Description="an example3"}, 22 | new Car{CarId=4, BrandId=3, ColorId=1, DailyPrice=120000, ModelYear=2020, Description="an example4"} 23 | }; 24 | } 25 | public void Add(Car car) 26 | { 27 | _cars.Add(car); 28 | } 29 | 30 | public void Delete(Car car) 31 | { 32 | Car carToDelete = _cars.SingleOrDefault(c => c.CarId == car.CarId); 33 | _cars.Remove(car); 34 | } 35 | public List GetAll() 36 | { 37 | return _cars; 38 | } 39 | public void Update(Car car) 40 | { 41 | 42 | Car carToUpdate = _cars.SingleOrDefault(c => c.CarId == car.CarId); 43 | carToUpdate.BrandId = car.BrandId; 44 | carToUpdate.ColorId = car.ColorId; 45 | carToUpdate.ModelYear = car.ModelYear; 46 | carToUpdate.DailyPrice = car.DailyPrice; 47 | carToUpdate.Description = car.Description; 48 | } 49 | public Car GetById(int id) 50 | { 51 | return _cars.SingleOrDefault(c => c.CarId == id); 52 | } 53 | 54 | public List GetAll(Expression> filter = null) 55 | { 56 | throw new NotImplementedException(); 57 | } 58 | 59 | public Car Get(Expression> filter) 60 | { 61 | throw new NotImplementedException(); 62 | } 63 | 64 | public List GetCarDetails() 65 | { 66 | throw new NotImplementedException(); 67 | } 68 | 69 | public List GetCarDetails(Expression> filter = null) 70 | { 71 | throw new NotImplementedException(); 72 | } 73 | 74 | public List GetCarDetails(Expression> filter = null) 75 | { 76 | throw new NotImplementedException(); 77 | } 78 | 79 | public List GetCarDetailById(int carId) 80 | { 81 | throw new NotImplementedException(); 82 | } 83 | 84 | public List GetCarDetailsByBrandAndColor(int brandId, int colorId) 85 | { 86 | throw new NotImplementedException(); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /DataAccess/DataAccess.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Entities/Concrete/Brand.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 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 BrandId { get; set; } 11 | 12 | public string BrandName { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Entities/Concrete/Car.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 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 CarId { get; set; } 11 | 12 | public int BrandId { get; set; } 13 | public int ColorId { get; set; } 14 | public string CarName { get; set; } 15 | public int ModelYear { get; set; } 16 | public decimal DailyPrice { get; set; } 17 | public string Description { get; set; } 18 | public int MinFindeksScore { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Entities/Concrete/CarImage.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 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 | 12 | public int CarId { get; set; } 13 | public string ImagePath { get; set; } 14 | public DateTime Date { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Entities/Concrete/CardInfo.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class CardInfo : IEntity 9 | { 10 | public int Id { get; set; } 11 | public string NameOnTheCard { get; set; } 12 | public string CardNumber { get; set; } 13 | public string CardCvv { get; set; } 14 | public decimal MoneyInTheCard { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Entities/Concrete/Color.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 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 ColorId { get; set; } 11 | 12 | public string ColorName { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Entities/Concrete/Customer.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 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 | 12 | public int UserId { get; set; } 13 | public string CompanyName { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Entities/Concrete/Findeks.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Entities.Concrete 6 | { 7 | public class Findeks 8 | { 9 | public string Tc { get; set; } 10 | public string DateYear { get; set; } 11 | public int UserFindeks { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Entities/Concrete/Rental.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 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 | 12 | public int CarId { get; set; } 13 | public int CustomerId { get; set; } 14 | public DateTime RentDate { get; set; } 15 | public DateTime? ReturnDate { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Entities/Concrete/User2.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class User2 : IEntity 9 | { 10 | public int Id { get; set; } 11 | 12 | public string FirstName { get; set; } 13 | public string LastName { get; set; } 14 | public string Email { get; set; } 15 | public string Password { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Entities/DTOs/CarDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class CarDetailDto : IDto 9 | { 10 | public int CarId { get; set; } 11 | 12 | public string CarName { get; set; } 13 | public int BrandId { get; set; } 14 | public string BrandName { get; set; } 15 | public int ColorId { get; set; } 16 | public string ColorName { get; set; } 17 | public string Description { get; set; } 18 | public int ModelYear { get; set; } 19 | public decimal DailyPrice { get; set; } 20 | 21 | public int ImageId { get; set; } 22 | public string ImagePath { get; set; } 23 | public DateTime Date { get; set; } 24 | 25 | public int MinFindeksScore { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Entities/DTOs/CarImageDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class CarImageDetailDto : IDto 9 | { 10 | 11 | public int CarId { get; set; } 12 | 13 | public string BrandName { get; set; } 14 | public string ColorName { get; set; } 15 | public int ModelYear { get; set; } 16 | public decimal DailyPrice { get; set; } 17 | public string Description { get; set; } 18 | public string ImagePath { get; set; } 19 | public DateTime Date { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Entities/DTOs/CustomerDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class CustomerDetailDto:IDto 9 | { 10 | public int UserId { get; set; } 11 | public string FirstName { get; set; } 12 | public string LastName { get; set; } 13 | public string Email { get; set; } 14 | public string Password { get; set; } 15 | public string CompanyName { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Entities/DTOs/RentalDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class RentalDetailDto :IDto 9 | { 10 | public int Id { get; set; } 11 | public int CarId { get; set; } 12 | public string CarName { get; set; } 13 | public string BrandName { get; set; } 14 | public string ColorName { get; set; } 15 | public string CustomerName { get; set; } 16 | public string UserName { get; set; } 17 | public string Email { get; set; } 18 | public DateTime RentDate { get; set; } 19 | public DateTime? ReturnDate { get; set; } 20 | public decimal DailyPrice { get; set; } 21 | public int ModelYear { get; set; } 22 | public string Description { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Entities/DTOs/RentalPaymentDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete.Payment; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Entities.DTOs 8 | { 9 | public class RentalPaymentDto 10 | { 11 | public Rental Rental { get; set; } 12 | public FakeCreditCardModel FakeCreditCardModel { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Entities/DTOs/UserForLoginDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 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 | -------------------------------------------------------------------------------- /Entities/DTOs/UserForRegisterDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | 3 | namespace Entities.DTOs 4 | { 5 | public class UserForRegisterDto : IDto 6 | { 7 | public string Email { get; set; } 8 | public string Password { get; set; } 9 | public string FirstName { get; set; } 10 | public string LastName { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Entities/DTOs/UserForUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using Core.Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Entities.DTOs 8 | { 9 | public class UserUpdateDto : IDto 10 | { 11 | public User User { get; set; } 12 | public string Password { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Entities/Entities.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Tuna ÖZKAN 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReCapRentACarProject-Backend 2 | Rent a Car Project - Nitelikli Yazılım Geliştirici Yetiştirme Kampı ; C# Console projesidir. 3 | Bu projede veri tabanında bulunan tablolardaki bilgiler kullanılarak gelen sonuçlar console üzerinde görüntülenmektedir. 4 | 5 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.4. 6 | 7 | ## Development server 8 | 9 | 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. 10 | 11 | ## Code scaffolding 12 | 13 | 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`. 14 | 15 | ## Build 16 | 17 | 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. 18 | 19 | ## Running unit tests 20 | 21 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 22 | 23 | ## Running end-to-end tests 24 | 25 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 26 | 27 | ## Further help 28 | 29 | 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. 30 | -------------------------------------------------------------------------------- /ReCapProject.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31019.35 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Business", "Business\Business.csproj", "{CE7ACCF7-DF50-4C4D-8874-1C24087D5B4A}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataAccess", "DataAccess\DataAccess.csproj", "{893E6F74-C821-4223-84A7-E542768218E6}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Entities", "Entities\Entities.csproj", "{24BEC315-4F29-4CC0-A2AF-FEF7545BFF3E}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleUI", "ConsoleUI\ConsoleUI.csproj", "{845FEB77-3088-44B0-A58C-0CD671790270}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{2DDD51AC-5E60-49FA-A84A-7E0A634425DF}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPI", "WebAPI\WebAPI.csproj", "{8292447A-F053-4B49-951F-F4FD2074CEC2}" 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 | {CE7ACCF7-DF50-4C4D-8874-1C24087D5B4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {CE7ACCF7-DF50-4C4D-8874-1C24087D5B4A}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {CE7ACCF7-DF50-4C4D-8874-1C24087D5B4A}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {CE7ACCF7-DF50-4C4D-8874-1C24087D5B4A}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {893E6F74-C821-4223-84A7-E542768218E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {893E6F74-C821-4223-84A7-E542768218E6}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {893E6F74-C821-4223-84A7-E542768218E6}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {893E6F74-C821-4223-84A7-E542768218E6}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {24BEC315-4F29-4CC0-A2AF-FEF7545BFF3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {24BEC315-4F29-4CC0-A2AF-FEF7545BFF3E}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {24BEC315-4F29-4CC0-A2AF-FEF7545BFF3E}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {24BEC315-4F29-4CC0-A2AF-FEF7545BFF3E}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {845FEB77-3088-44B0-A58C-0CD671790270}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {845FEB77-3088-44B0-A58C-0CD671790270}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {845FEB77-3088-44B0-A58C-0CD671790270}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {845FEB77-3088-44B0-A58C-0CD671790270}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {2DDD51AC-5E60-49FA-A84A-7E0A634425DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {2DDD51AC-5E60-49FA-A84A-7E0A634425DF}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {2DDD51AC-5E60-49FA-A84A-7E0A634425DF}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {2DDD51AC-5E60-49FA-A84A-7E0A634425DF}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {8292447A-F053-4B49-951F-F4FD2074CEC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {8292447A-F053-4B49-951F-F4FD2074CEC2}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {8292447A-F053-4B49-951F-F4FD2074CEC2}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {8292447A-F053-4B49-951F-F4FD2074CEC2}.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 = {40260659-8607-4506-AD8A-A51BF01FF09A} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /WebAPI/Controllers/AuthController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.DTOs; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace WebAPI.Controllers 6 | { 7 | [Route("api/[controller]")] 8 | [ApiController] 9 | public class AuthController : Controller 10 | { 11 | private IAuthService _authService; 12 | 13 | public AuthController(IAuthService authService) 14 | { 15 | _authService = authService; 16 | } 17 | 18 | [HttpPost("login")] 19 | public ActionResult Login(UserForLoginDto userForLoginDto) 20 | { 21 | var userToLogin = _authService.Login(userForLoginDto); 22 | if (!userToLogin.Success) 23 | { 24 | return BadRequest(userToLogin.Message); 25 | } 26 | 27 | var result = _authService.CreateAccessToken(userToLogin.Data); 28 | if (result.Success) 29 | { 30 | return Ok(result); 31 | } 32 | 33 | return BadRequest(result.Message); 34 | } 35 | 36 | [HttpPost("register")] 37 | public ActionResult Register(UserForRegisterDto userForRegisterDto) 38 | { 39 | var userExists = _authService.UserExists(userForRegisterDto.Email); 40 | if (!userExists.Success) 41 | { 42 | return BadRequest(userExists.Message); 43 | } 44 | 45 | var registerResult = _authService.Register(userForRegisterDto, userForRegisterDto.Password); 46 | var result = _authService.CreateAccessToken(registerResult.Data); 47 | if (result.Success) 48 | { 49 | return Ok(result); 50 | } 51 | 52 | return BadRequest(result.Message); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /WebAPI/Controllers/BrandsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace WebAPI.Controllers 6 | { 7 | [Route("api/[controller]")] 8 | [ApiController] 9 | public class BrandsController : ControllerBase 10 | { 11 | IBrandService _brandService; 12 | 13 | public BrandsController(IBrandService brandService) 14 | { 15 | _brandService = brandService; 16 | } 17 | 18 | [HttpGet("id")] 19 | public IActionResult GetById(int id) 20 | { 21 | var result = _brandService.GetBrandById(id); 22 | if (result.Success) 23 | { 24 | return Ok(result); 25 | } 26 | return BadRequest(result); 27 | } 28 | [HttpGet] 29 | public IActionResult GetAll() 30 | { 31 | var result = _brandService.GetAllBrand(); 32 | if (result.Success) 33 | { 34 | return Ok(result); 35 | } 36 | return BadRequest(result); 37 | 38 | } 39 | 40 | 41 | [HttpPost("add")] 42 | public IActionResult Add(Brand brand) 43 | { 44 | var result = _brandService.Add(brand); 45 | if (result.Success) 46 | { 47 | return Ok(result); 48 | } 49 | return BadRequest(result); 50 | } 51 | 52 | [HttpPost("update")] 53 | public IActionResult Update(Brand brand) 54 | { 55 | var result = _brandService.Update(brand); 56 | if (result.Success) 57 | { 58 | return Ok(result); 59 | } 60 | return BadRequest(result); 61 | } 62 | 63 | [HttpPost("delete")] 64 | public IActionResult Delete(Brand brand) 65 | { 66 | var result = _brandService.Delete(brand); 67 | if (result.Success) 68 | { 69 | return Ok(result); 70 | } 71 | return BadRequest(result); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarImagesController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | 6 | namespace WebAPI.Controllers 7 | { 8 | [Route("api/[controller]")] 9 | [ApiController] 10 | public class CarImagesController : ControllerBase 11 | { 12 | ICarImageService _carImageService; 13 | 14 | public CarImagesController(ICarImageService carImageService) 15 | { 16 | _carImageService = carImageService; 17 | } 18 | 19 | [HttpPost] 20 | public IActionResult Add([FromForm(Name = ("Image"))] IFormFile file, [FromForm] CarImage carImage) 21 | { 22 | var result = _carImageService.Add(file, carImage); 23 | if (!result.Success) 24 | return BadRequest(result); 25 | return Ok(result); 26 | } 27 | 28 | [HttpPut] 29 | public IActionResult Update([FromForm(Name = ("Image"))] IFormFile file, [FromForm] CarImage carImage) 30 | { 31 | var result = _carImageService.Update(file, carImage); 32 | if (!result.Success) 33 | return BadRequest(result); 34 | return Ok(result); 35 | } 36 | 37 | [HttpDelete] 38 | public IActionResult Delete([FromForm] CarImage carImage) 39 | { 40 | var result = _carImageService.Delete(carImage); 41 | if (!result.Success) 42 | return BadRequest(result); 43 | return Ok(result); 44 | } 45 | 46 | [HttpGet("getbyid")] 47 | public IActionResult GetById(int id) 48 | { 49 | var result = _carImageService.Get(id); 50 | if (!result.Success) 51 | return BadRequest(result); 52 | return Ok(result); 53 | } 54 | 55 | [HttpGet("getbycarid")] 56 | public IActionResult GetByCarId(int carId) 57 | { 58 | var result = _carImageService.GetByCarId(carId); 59 | if (!result.Success) 60 | return BadRequest(); 61 | return Ok(result); 62 | } 63 | 64 | [HttpGet] 65 | public IActionResult GetAll() 66 | { 67 | var result = _carImageService.GetAll(); 68 | if (!result.Success) 69 | return BadRequest(result); 70 | return Ok(result); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System.Threading; 5 | 6 | namespace WebAPI.Controllers 7 | { 8 | [Route("api/[controller]")] 9 | [ApiController] 10 | public class CarsController : ControllerBase 11 | { 12 | ICarService _carService; 13 | 14 | public CarsController(ICarService carService) 15 | { 16 | _carService = carService; 17 | } 18 | 19 | [HttpGet] 20 | public IActionResult GetAll() 21 | { 22 | var result = _carService.GetAll(); 23 | if (result.Success) 24 | { 25 | return Ok(result); 26 | } 27 | return BadRequest(result); 28 | } 29 | [HttpGet("id")] 30 | public IActionResult GetById(int id) 31 | { 32 | var result = _carService.GetById(id); 33 | if (result.Success) 34 | { 35 | return Ok(result); 36 | } 37 | return BadRequest(result); 38 | } 39 | 40 | 41 | [HttpGet("details")] 42 | public IActionResult GetCarDetails() 43 | { 44 | 45 | 46 | var result = _carService.GetCarDetails(); 47 | if (result.Success) 48 | { 49 | return Ok(result); 50 | } 51 | return BadRequest(result); 52 | } 53 | 54 | [HttpGet("detailsbyid")] 55 | public IActionResult GetCarDetailsById(int carId) 56 | { 57 | var result = _carService.GetCarDetailsById(carId); 58 | if (result.Success) 59 | { 60 | return Ok(result); 61 | } 62 | return BadRequest(result); 63 | } 64 | 65 | [HttpGet("CarsByBrandAndColor")] 66 | public IActionResult CarsByBrandAndColor(int brandId, int colorId) 67 | { 68 | var result = _carService.GetCarDetailsByBrandAndColor(brandId, colorId); 69 | if (result.Success) return Ok(result); 70 | return BadRequest(result); 71 | 72 | } 73 | 74 | 75 | [HttpPost("add")] 76 | public IActionResult Add(Car car) 77 | { 78 | var result = _carService.Add(car); 79 | if (result.Success) 80 | { 81 | return Ok(result); 82 | } 83 | return BadRequest(result); 84 | } 85 | 86 | [HttpPost("delete")] 87 | public IActionResult Delete(Car car) 88 | { 89 | var result = _carService.Delete(car); 90 | if (result.Success) 91 | { 92 | return Ok(result); 93 | } 94 | return BadRequest(result); 95 | } 96 | 97 | [HttpPost("update")] 98 | public IActionResult Update(Car car) 99 | { 100 | var result = _carService.Update(car); 101 | if (result.Success) 102 | { 103 | return Ok(result); 104 | } 105 | return BadRequest(result); 106 | } 107 | 108 | [HttpGet("detailsbycolor")] 109 | public IActionResult GetCarsByColorId(int colorId) 110 | { 111 | var result = _carService.GetCarsDetailByColorId(colorId); 112 | if (result.Success) 113 | { 114 | return Ok(result); 115 | } 116 | return BadRequest(result); 117 | } 118 | 119 | [HttpGet("detailsbybrand")] 120 | public IActionResult GetCarsByBrandId(int brandId) 121 | { 122 | 123 | var result = _carService.GetCarsDetailByBrandId(brandId); 124 | if (result.Success) 125 | { 126 | return Ok(result); 127 | } 128 | return BadRequest(result); 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /WebAPI/Controllers/ColorsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | 6 | namespace WebAPI.Controllers 7 | { 8 | [Route("api/[controller]")] 9 | [ApiController] 10 | public class ColorsController : ControllerBase 11 | { 12 | IColorService _ColorService; 13 | 14 | public ColorsController(IColorService ColorService) 15 | { 16 | _ColorService = ColorService; 17 | } 18 | 19 | [HttpGet] 20 | public IActionResult GetAll() 21 | { 22 | var result = _ColorService.GetAllColor(); 23 | if (result.Success) 24 | { 25 | return Ok(result); 26 | } 27 | return BadRequest(result); 28 | 29 | } 30 | [HttpGet("id")] 31 | public IActionResult GetById(int id) 32 | { 33 | var result = _ColorService.GetColorById(id); 34 | if (result.Success) 35 | { 36 | return Ok(result); 37 | } 38 | return BadRequest(result); 39 | } 40 | 41 | [HttpPost("add")] 42 | public IActionResult Add(Color color) 43 | { 44 | var result = _ColorService.Add(color); 45 | if (result.Success) 46 | { 47 | return Ok(result); 48 | } 49 | return BadRequest(result); 50 | } 51 | 52 | [HttpPost("update")] 53 | public IActionResult Update(Color color) 54 | { 55 | var result = _ColorService.Update(color); 56 | if (result.Success) 57 | { 58 | return Ok(result); 59 | } 60 | return BadRequest(result); 61 | } 62 | 63 | [HttpPost("delete")] 64 | public IActionResult Delete(Color color) 65 | { 66 | var result = _ColorService.Delete(color); 67 | if (result.Success) 68 | { 69 | return Ok(result); 70 | } 71 | return BadRequest(result); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CustomersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | 6 | namespace WebAPI.Controllers 7 | { 8 | [Route("api/[controller]")] 9 | [ApiController] 10 | public class CustomersController : ControllerBase 11 | { 12 | ICustomerService _customerService; 13 | 14 | public CustomersController(ICustomerService customerService) 15 | { 16 | _customerService = customerService; 17 | } 18 | 19 | [HttpGet] 20 | public IActionResult GetAll() 21 | { 22 | var result = _customerService.GetAllCustomer(); 23 | if (result.Success) 24 | { 25 | return Ok(result); 26 | } 27 | return BadRequest(result); 28 | } 29 | 30 | [HttpGet("id")] 31 | public IActionResult GetById(int id) 32 | { 33 | var result = _customerService.GetCustomerById(id); 34 | if (result.Success) 35 | { 36 | return Ok(result); 37 | } 38 | return BadRequest(result); 39 | } 40 | 41 | [HttpPost("add")] 42 | public IActionResult Add(Customer customer) 43 | { 44 | var result = _customerService.Add(customer); 45 | if (result.Success) 46 | { 47 | return Ok(result); 48 | } 49 | return BadRequest(result); 50 | } 51 | 52 | [HttpPost("update")] 53 | public IActionResult Update(Customer customer) 54 | { 55 | var result = _customerService.Update(customer); 56 | if (result.Success) 57 | { 58 | return Ok(result); 59 | } 60 | return BadRequest(result); 61 | } 62 | 63 | [HttpPost("delete")] 64 | public IActionResult Delete(Customer customer) 65 | { 66 | var result = _customerService.Delete(customer); 67 | if (result.Success) 68 | { 69 | return Ok(result); 70 | } 71 | return BadRequest(result); 72 | } 73 | [HttpGet("getdetails")] 74 | public IActionResult GetCustomerDetails() 75 | { 76 | var result = _customerService.GetCustomerDetails(); 77 | if (result.Success) 78 | { 79 | return Ok(result); 80 | } 81 | return BadRequest(result); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /WebAPI/Controllers/RentalsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | 7 | namespace WebAPI.Controllers 8 | { 9 | [Route("api/[controller]")] 10 | [ApiController] 11 | public class RentalsController : ControllerBase 12 | { 13 | IRentalService _rentalService; 14 | private IPaymentService _paymentService; 15 | public RentalsController(IRentalService rentalService, IPaymentService paymentService) 16 | { 17 | _rentalService = rentalService; 18 | _paymentService = paymentService; 19 | } 20 | 21 | [HttpGet] 22 | public IActionResult GetAll() 23 | { 24 | var result = _rentalService.GetAll(); 25 | if (result.Success) 26 | { 27 | return Ok(result); 28 | } 29 | return BadRequest(result); 30 | } 31 | 32 | [HttpGet("id")] 33 | public IActionResult GetRentalByCarId(int carId) 34 | { 35 | var result = _rentalService.GetById(carId); 36 | if (result.Success) 37 | { 38 | return Ok(result); 39 | } 40 | return BadRequest(result); 41 | } 42 | 43 | [HttpPost("add")] 44 | public IActionResult Add(Rental rental) 45 | { 46 | rental.RentDate = DateTime.Now; 47 | var result = _rentalService.Add(rental); 48 | if (result.Success) 49 | { 50 | return Ok(result); 51 | } 52 | return BadRequest(result); 53 | } 54 | 55 | [HttpPost("paymentadd")] 56 | public IActionResult PaymentAdd(RentalPaymentDto rentalPaymentDto) 57 | { 58 | var paymentResult = _paymentService.MakePayment(rentalPaymentDto.FakeCreditCardModel); 59 | if (!paymentResult.Success) 60 | { 61 | return BadRequest(paymentResult); 62 | } 63 | rentalPaymentDto.Rental.RentDate = DateTime.Now; 64 | var result = _rentalService.Add(rentalPaymentDto.Rental); 65 | 66 | if (result.Success) 67 | return Ok(result); 68 | 69 | return BadRequest(result.Message); 70 | } 71 | 72 | 73 | [HttpPost("update")] 74 | public IActionResult Update(Rental rental) 75 | { 76 | var result = _rentalService.Update(rental); 77 | if (result.Success) 78 | { 79 | return Ok(result); 80 | } 81 | return BadRequest(result); 82 | } 83 | 84 | [HttpPost("delete")] 85 | public IActionResult Delete(Rental rental) 86 | { 87 | var result = _rentalService.Delete(rental); 88 | if (result.Success) 89 | { 90 | return Ok(result); 91 | } 92 | return BadRequest(result); 93 | } 94 | 95 | [HttpGet("details")] 96 | public IActionResult GetRentalDetails() 97 | { 98 | var result = _rentalService.GetRentalDetails(); 99 | if (result.Success) 100 | { 101 | return Ok(result); 102 | } 103 | return BadRequest(result); 104 | } 105 | 106 | [HttpGet("detailsbycar")] 107 | public IActionResult GetById(int id) 108 | { 109 | 110 | var result = _rentalService.GetRentalDetailsById(id); 111 | if (result.Success) 112 | { 113 | return Ok(result); 114 | } 115 | return BadRequest(result); 116 | } 117 | 118 | [HttpGet("detailsbycustomer")] 119 | public IActionResult GetRentalBycustomerId(int customerId) 120 | { 121 | 122 | var result = _rentalService.GetRentalDetailsById(customerId); 123 | if (result.Success) 124 | { 125 | return Ok(result); 126 | } 127 | return BadRequest(result); 128 | } 129 | 130 | } 131 | } -------------------------------------------------------------------------------- /WebAPI/Controllers/UsersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Entities.Concrete; 3 | using Entities.Concrete; 4 | using Entities.DTOs; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace WebAPI.Controllers 8 | { 9 | [Route("api/[controller]")] 10 | [ApiController] 11 | public class UsersController : ControllerBase 12 | { 13 | IUserService _userService; 14 | 15 | public UsersController(IUserService userService) 16 | { 17 | _userService = userService; 18 | } 19 | 20 | [HttpGet("getall")] 21 | public IActionResult GetAll() 22 | { 23 | var result = _userService.GetAll(); 24 | if (result.Success) 25 | { 26 | return Ok(result); 27 | } 28 | return BadRequest(result); 29 | } 30 | 31 | [HttpGet("getbyid")] 32 | public IActionResult GetById(int id) 33 | { 34 | var result = _userService.GetById(id); 35 | if (result.Success) 36 | { 37 | return Ok(result); 38 | } 39 | return BadRequest(result); 40 | } 41 | [HttpGet("getbyemail")] 42 | public IActionResult GetByEmail(string email) 43 | { 44 | var result = _userService.GetByEmail(email); 45 | if (result.Success) 46 | { 47 | return Ok(new 48 | { 49 | result.Data.Id, 50 | result.Data.FirstName, 51 | result.Data.LastName, 52 | result.Data.Email, 53 | result.Data.Status 54 | }); 55 | } 56 | return BadRequest(result); 57 | } 58 | /* 59 | [CacheAspect] 60 | [PerformanceAspect(5)] 61 | public IDataResult GetByMail(string email) 62 | { 63 | var result = new SuccessDataResult(_userDal.Get(u => u.Email == email)); 64 | return result; 65 | }*/ 66 | [HttpPost("add")] 67 | public IActionResult Add(User user) 68 | { 69 | var result = _userService.Add(user); 70 | if (result.Success) 71 | { 72 | return Ok(result); 73 | } 74 | return BadRequest(result); 75 | } 76 | 77 | [HttpPost("update")] 78 | public IActionResult Update(User user) 79 | { 80 | var result = _userService.Update(user); 81 | if (result.Success) 82 | { 83 | return Ok(result); 84 | } 85 | return BadRequest(result); 86 | } 87 | 88 | [HttpPost("delete")] 89 | public IActionResult Delete(User user) 90 | { 91 | var result = _userService.Delete(user); 92 | if (result.Success) 93 | { 94 | return Ok(result); 95 | } 96 | return BadRequest(result); 97 | } 98 | 99 | [HttpPost("getuserfindeks")] 100 | public IActionResult GetUserFindeks(Findeks findeks) 101 | { 102 | var result = _userService.GetUserFindeks(findeks); 103 | if (result.Success) 104 | { 105 | return Ok(result); 106 | } 107 | 108 | return BadRequest(result); 109 | } 110 | 111 | [HttpPost("updateprofile")] 112 | public IActionResult ProfileUpdate(UserUpdateDto userForUpdateDto) 113 | { 114 | var result = _userService.UpdateProfile(userForUpdateDto.User, userForUpdateDto.Password); 115 | if (result.Success) 116 | { 117 | return Ok(result); 118 | } 119 | return BadRequest(result); 120 | } 121 | 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /WebAPI/Controllers/WeatherForecastController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.Extensions.Logging; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace WebAPI.Controllers 9 | { 10 | [ApiController] 11 | [Route("[controller]")] 12 | public class WeatherForecastController : ControllerBase 13 | { 14 | private static readonly string[] Summaries = new[] 15 | { 16 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 17 | }; 18 | 19 | private readonly ILogger _logger; 20 | 21 | public WeatherForecastController(ILogger logger) 22 | { 23 | _logger = logger; 24 | } 25 | 26 | [HttpGet] 27 | public IEnumerable Get() 28 | { 29 | var rng = new Random(); 30 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast 31 | { 32 | Date = DateTime.Now.AddDays(index), 33 | TemperatureC = rng.Next(-20, 55), 34 | Summary = Summaries[rng.Next(Summaries.Length)] 35 | }) 36 | .ToArray(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /WebAPI/Program.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Extensions.DependencyInjection; 3 | using Business.DependencyResolvers.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 | -------------------------------------------------------------------------------- /WebAPI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:51760", 8 | "sslPort": 44334 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "weatherforecast", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "WebAPI": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "launchUrl": "weatherforecast", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /WebAPI/Startup.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/Startup.cs -------------------------------------------------------------------------------- /WebAPI/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace WebAPI 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /WebAPI/WebAPI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /WebAPI/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /WebAPI/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "TokenOptions": { 3 | "Audience": "tuna@tuna.com", 4 | "Issuer": "tuna@tuna.com", 5 | "AccessTokenExpiration": 10, 6 | "SecurityKey": "mysupersecretkeymysupersecretkey" 7 | }, 8 | "Logging": { 9 | "LogLevel": { 10 | "Default": "Information", 11 | "Microsoft": "Warning", 12 | "Microsoft.Hosting.Lifetime": "Information" 13 | } 14 | }, 15 | "AllowedHosts": "*" 16 | } 17 | -------------------------------------------------------------------------------- /WebAPI/log4net.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/02597379-3b78-4887-af14-2fb9ebafd91a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/02597379-3b78-4887-af14-2fb9ebafd91a.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/149e9802-d9b8-46e3-bff5-38b22ee8f539.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/149e9802-d9b8-46e3-bff5-38b22ee8f539.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/164626d8-18fc-40d0-b048-16d4a33c178e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/164626d8-18fc-40d0-b048-16d4a33c178e.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/1950484a-3886-4296-af9a-045799839398.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/1950484a-3886-4296-af9a-045799839398.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/1f0c625e-1b35-40d2-8521-6c076adec5ea.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/1f0c625e-1b35-40d2-8521-6c076adec5ea.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/25c8128d-e515-42c2-83d5-cc3797f12a92.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/25c8128d-e515-42c2-83d5-cc3797f12a92.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/2a3c31d0-06bd-40cf-9a84-c01618d1626b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/2a3c31d0-06bd-40cf-9a84-c01618d1626b.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/2d0f31aa-fe3d-4c4c-af6c-b58c2cdd107c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/2d0f31aa-fe3d-4c4c-af6c-b58c2cdd107c.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/2df18095-4a34-4ce4-a2d4-86790a75a234.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/2df18095-4a34-4ce4-a2d4-86790a75a234.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/4736093d-2e53-4c08-8b03-506f151bf528.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/4736093d-2e53-4c08-8b03-506f151bf528.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/47aa0e1c-3f8b-4c57-a4f9-440566becfb7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/47aa0e1c-3f8b-4c57-a4f9-440566becfb7.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/4aecfb75-50ef-4ab1-b031-298792fbe9f2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/4aecfb75-50ef-4ab1-b031-298792fbe9f2.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/57277708-91c4-45ba-b32d-1d869ae90ac7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/57277708-91c4-45ba-b32d-1d869ae90ac7.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/5b0f5cbb-fe2e-4640-9b1e-5a249fa183a1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/5b0f5cbb-fe2e-4640-9b1e-5a249fa183a1.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/5d34efa8-afd1-4c0a-856e-8882d7cee7da.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/5d34efa8-afd1-4c0a-856e-8882d7cee7da.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/67106cb2-18ec-4a6c-aa41-637793baa541.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/67106cb2-18ec-4a6c-aa41-637793baa541.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/716207b1-c7e8-4981-9cdf-ac54f06b1fb3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/716207b1-c7e8-4981-9cdf-ac54f06b1fb3.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/71d1a806-f674-46e8-a99a-e28bb67102fd.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/71d1a806-f674-46e8-a99a-e28bb67102fd.jpeg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/7bb9df9a-91a8-4c40-9770-242822abd251.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/7bb9df9a-91a8-4c40-9770-242822abd251.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/7ee3971e-d145-4658-a7b3-dc81e239e2f8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/7ee3971e-d145-4658-a7b3-dc81e239e2f8.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/88bae036-10d2-4f89-82e7-a799f5eade3e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/88bae036-10d2-4f89-82e7-a799f5eade3e.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/8a75b29f-4b65-42ef-ab4c-61dc7eb55d66.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/8a75b29f-4b65-42ef-ab4c-61dc7eb55d66.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/8ba2e167-f02f-4767-b6ce-ede7b6e55dcd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/8ba2e167-f02f-4767-b6ce-ede7b6e55dcd.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/8e78f9ce-22af-4138-aad9-add4a37d7949.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/8e78f9ce-22af-4138-aad9-add4a37d7949.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/95d37396-1f12-4ef5-a837-8555acc2af14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/95d37396-1f12-4ef5-a837-8555acc2af14.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/96299137-090f-46a7-b0dc-a5225d0219d5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/96299137-090f-46a7-b0dc-a5225d0219d5.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/9874f148-cf75-4143-b5f4-e95451f0925c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/9874f148-cf75-4143-b5f4-e95451f0925c.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/9f6d2b3c-2bce-4bf9-bb5e-f3c1e4136104.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/9f6d2b3c-2bce-4bf9-bb5e-f3c1e4136104.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/Thumbs.db -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a720c046-08cc-4c16-a79e-483d0e71721b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/a720c046-08cc-4c16-a79e-483d0e71721b.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a7878dc0-6823-483a-8ee0-462a25a468f0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/a7878dc0-6823-483a-8ee0-462a25a468f0.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ac578594-9dff-482c-9d00-9b4c72d17c25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/ac578594-9dff-482c-9d00-9b4c72d17c25.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/adbf1f8c-dfdf-4f1e-9ef0-cc94cb049cd7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/adbf1f8c-dfdf-4f1e-9ef0-cc94cb049cd7.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/c84b833b-1c32-40b3-855a-cb45f357b50c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/c84b833b-1c32-40b3-855a-cb45f357b50c.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ccd2d5fc-4354-4e37-90ff-38c1a3827b9d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/ccd2d5fc-4354-4e37-90ff-38c1a3827b9d.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ce20ce68-6a78-4b19-a9d7-e4db742ab2eb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/ce20ce68-6a78-4b19-a9d7-e4db742ab2eb.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/d751a929-7fab-4bb6-9f6c-3ffff067f669.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/d751a929-7fab-4bb6-9f6c-3ffff067f669.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/dbc535e0-ffca-4bd1-a1d6-de02ae06e2c1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/dbc535e0-ffca-4bd1-a1d6-de02ae06e2c1.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/dd41e408-5cf7-41d9-a854-09851bbdc8e0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/dd41e408-5cf7-41d9-a854-09851bbdc8e0.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/e4c00183-bb7f-489a-a966-c8eb33b28925.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/e4c00183-bb7f-489a-a966-c8eb33b28925.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/e9209488-37fe-445c-8c97-2791cd0c61f8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/e9209488-37fe-445c-8c97-2791cd0c61f8.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ed6422b2-18d5-4a57-8b7d-457d29e89535.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/ed6422b2-18d5-4a57-8b7d-457d29e89535.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ed6a8dca-b035-4e92-ac2b-16ef9868649c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/ed6a8dca-b035-4e92-ac2b-16ef9868649c.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/f33641fd-eba9-473a-826e-06fc298e53e4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/f33641fd-eba9-473a-826e-06fc298e53e4.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/fbb1a064-7f28-47a5-a7e6-a6cef3967027.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/fbb1a064-7f28-47a5-a7e6-a6cef3967027.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/fda062b9-71ac-4c43-8bf8-2133d05e35c0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/fda062b9-71ac-4c43-8bf8-2133d05e35c0.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ff42e01f-23b6-4e42-bc9a-636f6a94ef6d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/ff42e01f-23b6-4e42-bc9a-636f6a94ef6d.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tunazkn/ReCapRentACarProject-Backend/f597544f8b3b67576b31045a02998c076dbcac5c/WebAPI/wwwroot/Images/logo.jpg --------------------------------------------------------------------------------