├── .gitattributes ├── .gitignore ├── Business ├── Abstract │ ├── IAuthService.cs │ ├── IBrandService.cs │ ├── ICarImageService.cs │ ├── ICarService.cs │ ├── IColorService.cs │ ├── ICustomerService.cs │ ├── IRentalService.cs │ └── IUserService.cs ├── Business.csproj ├── BusinessAspects │ └── Autofac │ │ └── SecuredOperation.cs ├── Concrete │ ├── AuthManager.cs │ ├── BrandManager.cs │ ├── CarImageManager.cs │ ├── CarManager.cs │ ├── ColorManager.cs │ ├── CustomerManager.cs │ ├── RentalManager.cs │ └── UserManager.cs ├── Constants │ └── Messages.cs ├── DependencyResolvers │ └── Autofac │ │ └── AutofacBusinessModule.cs └── ValidationRules │ └── FluentValidation │ ├── CarImageValidator.cs │ └── CarValidator.cs ├── ConsoleUI ├── ConsoleUI.csproj └── Program.cs ├── Core ├── Aspects │ └── Autofac │ │ ├── Caching │ │ ├── CacheAspect.cs │ │ └── CacheRemoveAspect.cs │ │ ├── Performance │ │ └── PerformanceAspect.cs │ │ ├── Transaction │ │ └── TransactionScopeAspect.cs │ │ └── Validation │ │ └── ValidationAspect.cs ├── Core.csproj ├── CrossCuttingConcerns │ ├── Caching │ │ ├── ICacheManager.cs │ │ └── Microsoft │ │ │ └── MemoryCacheManager.cs │ └── Validation │ │ └── ValidationTool.cs ├── DataAccess │ ├── EntityFramework │ │ └── EfEntityRepositoryBase.cs │ └── IEntityRepository.cs ├── DependencyResolvers │ └── CoreModule.cs ├── Entities │ ├── Concrete │ │ ├── OperationClaim.cs │ │ ├── User.cs │ │ └── UserOperationClaim.cs │ ├── IDto.cs │ └── IEntity.cs ├── Extensions │ ├── ClaimExtensions.cs │ ├── ClaimsPrincipalExtensions.cs │ └── ServiceCollectionExtensions.cs └── Utilities │ ├── Business │ └── BusinessRules.cs │ ├── Interceptors │ ├── AspectInterceptorSelector.cs │ ├── MethodInterception.cs │ └── MethodInterceptionBaseAttribute.cs │ ├── IoC │ ├── ICoreModule.cs │ └── ServiceTool.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 │ └── Uploads │ └── FileHelper │ └── FileHelper.cs ├── DataAccess ├── Abstract │ ├── IBrandDal.cs │ ├── ICarDal.cs │ ├── ICarImageDal.cs │ ├── IColorDal.cs │ ├── ICustomerDal.cs │ ├── IRentalDal.cs │ └── IUserDal.cs ├── Concrete │ ├── EntityFramework │ │ ├── CarRentalContext.cs │ │ ├── EfBrandDal.cs │ │ ├── EfCarDal.cs │ │ ├── EfCarImageDal.cs │ │ ├── EfColorDal.cs │ │ ├── EfCustomerDal.cs │ │ ├── EfRentalDal.cs │ │ └── EfUserDal.cs │ └── InMemory │ │ └── InMemoryCarDal.cs └── DataAccess.csproj ├── Entities ├── Concrete │ ├── Brand.cs │ ├── Car.cs │ ├── CarImage.cs │ ├── Color.cs │ ├── Customer.cs │ └── Rental.cs ├── DTOs │ ├── CarDetailDto.cs │ ├── RentalDetailDto.cs │ ├── UserForLoginDto.cs │ └── UserForRegisterDto.cs └── Entities.csproj ├── ReCapProject.sln └── WebAPI ├── Controllers ├── AuthController.cs ├── BrandsController.cs ├── CarImagesController.cs ├── CarsController.cs ├── ColorsController.cs ├── CustomersController.cs ├── RentalsController.cs ├── UsersController.cs └── WeatherForecastController.cs ├── Images └── ImageUpload.cs ├── Program.cs ├── Properties └── launchSettings.json ├── Startup.cs ├── WeatherForecast.cs ├── WebAPI.csproj ├── appsettings.Development.json ├── appsettings.json └── wwwroot ├── Images ├── 19b9e66819154993bd29e1ebf59ebc4f.jpg ├── 21dd8e75467b480290d636eb345cb986.jpg ├── 2803ae45f76e4799924388abac31971c.jpg ├── 38e0c1137c7a4945afcb6e6ef770b2bf.jpg ├── 3e1d125ff93648c6a0a7249458c8c3cd.jpg ├── 4071b2e0bd62430f9f24e349a74402c4.jpg ├── 4233679d946a46bc891ce350e0becc2e.jpg ├── 47d01cb1b97441269aebf2867ba5d821.jpg ├── 492903d7c4df43b59e958401f27e4e90.jpg ├── 547f8262a6b04d5190ba4611fedd1bbc.jpg ├── 55f3ea603865481ca05a995229160425.jpg ├── 601dedade69b4253b6d34cb1e5eb4c29.jpg ├── 67605d003e404f6bb3f53fcd5f8373c4.jpg ├── 6c73807e7bbf463dae2ee45fe554c123.jpg ├── 8161e059c1f941af8206690fbeba6393.jpg ├── 845731b561774c26b0bc4212b48aece1.jpg ├── 87ef8862068549b98f833aa9a4c37e10.jpg ├── 9120733a0501410ebf90e5c9d71c9bab.jpg ├── 98a86a03d4ac48dfae0dd15f90b0f7e0.jpg ├── 9aff00c526bb4355882ff8fccc9b0608.jpg ├── a63ab671346f4c23a1befa1a43c98e55.jpg ├── a64793ab4dae4db2b7a94a29923b1005.jpg ├── ab2eddf1685340349c4ebce018d635dd.jpg ├── af4b13490599484fb399f243e9ac6db4.jpg ├── b67d9f79a2e24b3598d0e7921bdb7162.jpg ├── bd640378aaad4c09a9a2219008deac1b.jpg ├── c0c845866b6b4a33992b833c5a9cd911.jpg ├── c88024227dae4327ae712b7e424db717.jpg ├── c9982451a69f4fdfa88e79948c8f638d.jpg ├── d21ae256027d477c8d27e29c703d8c34.jpg ├── dfa9dffc00ff45179cc588aeea94c4fa.jpg ├── e27a50f81933492f87df5da3d9b1473c.jpg ├── f301539c220c46b4bbbe6f280a23a90a.jpg ├── f4074e7e478e48f2b8d8585fd255f045.jpg ├── f656f6d6322c4566a6658cdcd1f01022.jpg └── fbbfb35cd59c45e6a54a235a7242d384.jpg └── uploads ├── 1.Hyundai i20.jfif ├── 1.Peugeot 301.jfif ├── 1.Skoda.jfif ├── 2.Hyundai i20.jfif ├── 2.Peugeot 301.jfif ├── 2.Skoda.jfif ├── 3.Hyundai i20.jfif ├── 3.Skoda.jfif └── hyundai.jfif /.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 -------------------------------------------------------------------------------- /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 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace Business.Abstract 10 | { 11 | public interface IAuthService 12 | { 13 | IDataResult Register(UserForRegisterDto userForRegisterDto, string password); 14 | IDataResult Login(UserForLoginDto userForLoginDto); 15 | IResult UserExists(string email); 16 | IDataResult CreateAccessToken(User user); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Business/Abstract/IBrandService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Business.Abstract 8 | { 9 | public interface IBrandService 10 | { 11 | IDataResult> GetAll(); 12 | IDataResult GetByBrandId(int brandId); 13 | IResult Add(Brand brand); 14 | IResult Update(Brand brand); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Business/Abstract/ICarImageService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface ICarImageService 11 | { 12 | IDataResult> GetAll(); 13 | IDataResult> GetImagesByCarId(int carId); 14 | IDataResult GetById(int imageId); 15 | IResult Add(IFormFile file, CarImage carImage); 16 | IResult AddCollective(IFormFile[] files, CarImage carImage); 17 | IResult Update(IFormFile file, CarImage carImage); 18 | IResult Delete(CarImage carImage); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface ICarService 11 | { 12 | IDataResult> GetAll(); 13 | IDataResult> GetCarsByBrandId(int brandId); 14 | IDataResult> GetCarsByColorId(int colorId); 15 | IDataResult> GetCarDetails(); 16 | IDataResult GetById(int carId); 17 | IResult Add(Car car); 18 | IResult Update(Car car); 19 | IResult Delete(Car car); 20 | IDataResult> GetCarDetailsByCarId(int carId); 21 | IDataResult> GetCarsByBrandIdAndColorId(int brandId, int colorId); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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> GetAll(); 12 | IDataResult GetByColorId(int colorId); 13 | IResult Add(Color color); 14 | IResult Update(Color color); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Business/Abstract/ICustomerService.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 ICustomerService 10 | { 11 | IDataResult> GetAll(); 12 | IResult Add(Customer customer); 13 | IResult Delete(Customer customer); 14 | IResult Update(Customer customer); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /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 | IDataResult> GetAll(); 13 | IDataResult> GetRentalDetailsDto(int carId); 14 | IResult CheckReturnDate(int carId); 15 | 16 | IResult Add(Rental rental); 17 | IResult Update(Rental rental); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Business/Abstract/IUserService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface IUserService 11 | { 12 | List GetClaims(User user); 13 | IDataResult> GetAll(); 14 | IResult Add(User user); 15 | IResult Delete(User user); 16 | IResult Update(User user); 17 | User GetByMail(string email); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Business/BusinessAspects/Autofac/SecuredOperation.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.Utilities.Interceptors; 3 | using Core.Utilities.IoC; 4 | using Microsoft.AspNetCore.Http; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Core.Extensions; 10 | using Business.Constants; 11 | 12 | namespace Business.BusinessAspects.Autofac 13 | { 14 | public class SecuredOperation : MethodInterception 15 | { 16 | private string[] _roles; 17 | private IHttpContextAccessor _httpContextAccessor; 18 | 19 | public SecuredOperation(string roles) 20 | { 21 | _roles = roles.Split(','); 22 | _httpContextAccessor = ServiceTool.ServiceProvider.GetService(); 23 | 24 | } 25 | 26 | protected override void OnBefore(IInvocation invocation) 27 | { 28 | var roleClaims = _httpContextAccessor.HttpContext.User.ClaimRoles(); 29 | foreach (var role in _roles) 30 | { 31 | if (roleClaims.Contains(role)) 32 | { 33 | return; 34 | } 35 | } 36 | throw new Exception(Messages.AuthorizationDenied); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Business/Concrete/AuthManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Core.Entities.Concrete; 4 | using Core.Utilities.Results; 5 | using Core.Utilities.Security.Hashing; 6 | using Core.Utilities.Security.JWT; 7 | using Entities.DTOs; 8 | 9 | namespace Business.Concrete 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.GetByMail(userForLoginDto.Email); 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 | if (_userService.GetByMail(email) != null) 58 | { 59 | return new ErrorResult(Messages.UserAlreadyExists); 60 | } 61 | return new SuccessResult(); 62 | } 63 | 64 | public IDataResult CreateAccessToken(User user) 65 | { 66 | var claims = _userService.GetClaims(user); 67 | var accessToken = _tokenHelper.CreateToken(user, claims); 68 | return new SuccessDataResult(accessToken, Messages.AccessTokenCreated); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Business/Concrete/BrandManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Utilities.Results; 3 | using DataAccess.Abstract; 4 | using Entities.Concrete; 5 | using Entities.DTOs; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | using Business.ValidationRules.FluentValidation; 10 | using Core.Aspects.Autofac.Validation; 11 | using Business.BusinessAspects.Autofac; 12 | using Core.Aspects.Autofac.Caching; 13 | using System.Linq; 14 | using Business.Constants; 15 | 16 | namespace Business.Concrete 17 | { 18 | public class BrandManager : IBrandService 19 | { 20 | IBrandDal _brandDal; 21 | 22 | public BrandManager(IBrandDal brandDal) 23 | { 24 | _brandDal = brandDal; 25 | } 26 | 27 | //[CacheAspect] 28 | public IDataResult> GetAll() 29 | { 30 | return new SuccessDataResult>(_brandDal.GetAll()); 31 | 32 | } 33 | 34 | [SecuredOperation("admin, product.add")] 35 | [CacheRemoveAspect("IBrandService.Get")] 36 | public IResult Add(Brand brand) 37 | { 38 | _brandDal.Add(brand); 39 | return new SuccessResult(); 40 | 41 | } 42 | [CacheRemoveAspect("IBrandService.Get")] 43 | public IResult Update(Brand brand) 44 | { 45 | _brandDal.Update(brand); 46 | return new SuccessResult(); 47 | } 48 | 49 | public IDataResult GetByBrandId(int brandId) 50 | { 51 | return new SuccessDataResult(_brandDal.Get(b => b.BrandId == brandId)); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Business/Concrete/CarImageManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net.Mime; 6 | using System.Text; 7 | using Business.Abstract; 8 | using Business.Constants; 9 | using Business.ValidationRules.FluentValidation; 10 | using Core.Aspects.Autofac.Caching; 11 | using Core.Aspects.Autofac.Validation; 12 | using Core.Utilities.Business; 13 | using Core.Utilities.Results; 14 | using Core.Utilities.Uploads.ImageUploads; 15 | using DataAccess.Abstract; 16 | using Entities.Concrete; 17 | using Microsoft.AspNetCore.Http; 18 | 19 | namespace Business.Concrete 20 | { 21 | public class CarImageManager : ICarImageService 22 | { 23 | private ICarImageDal _imageDal; 24 | 25 | public CarImageManager(ICarImageDal imageDal) 26 | { 27 | _imageDal = imageDal; 28 | } 29 | 30 | 31 | 32 | [CacheAspect] 33 | public IDataResult> GetAll() 34 | { 35 | return new SuccessDataResult>(_imageDal.GetAll(), Messages.Listed); 36 | } 37 | 38 | 39 | 40 | //[CacheAspect] 41 | //public IDataResult> GetImagesByCarId(int carId) 42 | //{ 43 | // var result = _imageDal.GetAll(i => i.CarId == carId); 44 | 45 | // if (result.Count > 0) 46 | // { 47 | // return new SuccessDataResult>(result); 48 | // } 49 | 50 | // List images = new List(); 51 | // //images.Add(new CarImage() { CarId = 0, CarImageId = 0, Date = DateTime.Now, ImagePath = "/Images/f4074e7e478e48f2b8d8585fd255f045.jpg" }); 52 | 53 | // return new SuccessDataResult>(images); 54 | //} 55 | 56 | 57 | 58 | 59 | [CacheAspect] 60 | public IDataResult GetById(int imageId) 61 | { 62 | return new SuccessDataResult(_imageDal.Get(i => i.CarImageId == imageId)); 63 | 64 | } 65 | 66 | 67 | 68 | //[CacheRemoveAspect("ICarImageService.Get")] 69 | public IResult Add(IFormFile file, CarImage carImage) 70 | { 71 | var result = BusinessRules.Run( 72 | CheckIfImageCount(carImage), 73 | CheckIfImageExtensionValid(file)); 74 | 75 | if (result != null) 76 | { 77 | return result; 78 | } 79 | 80 | 81 | carImage.ImagePath = FileHelper.Add(file); 82 | carImage.Date = DateTime.Now; 83 | _imageDal.Add(carImage); 84 | return new SuccessResult("Car image added"); 85 | 86 | } 87 | 88 | public IResult AddCollective(IFormFile[] files, CarImage carImage) 89 | { 90 | foreach (var file in files) 91 | { 92 | carImage = new CarImage { CarId = carImage.CarId }; 93 | Add(file, carImage); 94 | } 95 | return new SuccessResult(); 96 | } 97 | 98 | 99 | 100 | [CacheRemoveAspect("ICarImageService.Get")] 101 | public IResult Update(IFormFile file, CarImage carImage) 102 | { 103 | var result = BusinessRules.Run( 104 | CheckIfImageExtensionValid(file)); 105 | 106 | if (result != null) 107 | { 108 | return result; 109 | } 110 | 111 | CarImage oldCarImage = GetById(carImage.CarImageId).Data; 112 | carImage.ImagePath = FileHelper.Update(file, oldCarImage.ImagePath); 113 | carImage.Date = DateTime.Now; 114 | carImage.CarId = oldCarImage.CarId; 115 | _imageDal.Update(carImage); 116 | return new SuccessResult("Car image updated"); 117 | } 118 | 119 | 120 | 121 | [CacheRemoveAspect("ICarImageService.Get")] 122 | public IResult Delete(CarImage carImage) 123 | { 124 | 125 | string oldPath = GetById(carImage.CarImageId).Data.ImagePath; 126 | FileHelper.Delete(oldPath); 127 | _imageDal.Delete(carImage); 128 | return new SuccessResult(Messages.Deleted); 129 | } 130 | 131 | private IResult CheckIfImageCount(CarImage carImage) 132 | { 133 | List gelAll = _imageDal.GetAll(i => i.CarId == carImage.CarId); 134 | var result = (gelAll.Count() >= 15); 135 | if (result) 136 | { 137 | return new ErrorResult("Bir aracın en fazla 5 resmi olabilir."); 138 | } 139 | return new SuccessResult(); 140 | } 141 | 142 | private IResult CheckIfImageExtensionValid(IFormFile file) 143 | { 144 | string[] validImageFileTypes = { ".JPG", ".JPEG", ".PNG", ".TIF", ".TIFF", ".GIF", ".BMP", ".ICO", ".WEBP" }; 145 | var result = validImageFileTypes.Any(t => t == Path.GetExtension(file.FileName).ToUpper()); 146 | if (!result) 147 | { 148 | return new ErrorResult("Geçersiz uzantı"); 149 | } 150 | return new SuccessResult(); 151 | } 152 | 153 | [ValidationAspect(typeof(CarImageValidator))] 154 | [CacheAspect] 155 | public IDataResult> GetImagesByCarId(int carId) 156 | { 157 | return new SuccessDataResult>(CheckIfCarImageNull(carId), Messages.CarImagesListed); 158 | } 159 | 160 | private List CheckIfCarImageNull(int carId) 161 | { 162 | string path = @"\Images\f4074e7e478e48f2b8d8585fd255f045.jpg"; 163 | var result = _imageDal.GetAll(c => c.CarId == carId).Any(); 164 | if (!result) 165 | { 166 | return new List { new CarImage { CarId = carId, ImagePath = path, Date = DateTime.Now } }; 167 | } 168 | return _imageDal.GetAll(p => p.CarId == carId); 169 | } 170 | } 171 | 172 | 173 | } -------------------------------------------------------------------------------- /Business/Concrete/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.Validation; 7 | using Core.Aspects.Autofact.Performance; 8 | using Core.CrossCuttingConcerns.Validation; 9 | using Core.Utilities.Results; 10 | using DataAccess.Abstract; 11 | using Entities.Concrete; 12 | using Entities.DTOs; 13 | using FluentValidation; 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | using System.Text; 18 | 19 | namespace Business.Concrete 20 | { 21 | public class CarManager : ICarService 22 | { 23 | private ICarDal _carDal; 24 | public CarManager(ICarDal carDal) 25 | { 26 | _carDal = carDal; 27 | } 28 | 29 | [SecuredOperation("car.add")] 30 | [ValidationAspect(typeof(CarValidator))] 31 | public IResult Add(Car car) 32 | { 33 | _carDal.Add(car); 34 | 35 | return new SuccessResult(Messages.CarAdded); 36 | } 37 | public IResult Delete(Car car) 38 | { 39 | _carDal.Delete(car); 40 | return new SuccessResult(Messages.CarDeleted); 41 | } 42 | 43 | public IDataResult> GetCarDetails() 44 | { 45 | return new SuccessDataResult>(_carDal.GetCarDetails()); 46 | } 47 | 48 | public IDataResult> GetCarDetailsByCarId(int carId) 49 | { 50 | return new SuccessDataResult>(_carDal.GetCarDetails().Where(x=>x.CarId==carId).ToList()); 51 | } 52 | 53 | [CacheAspect] 54 | public IDataResult> GetAll() 55 | { 56 | return new SuccessDataResult>(_carDal.GetCarDetails(c => c.DailyPrice!=0)); 57 | } 58 | 59 | public IDataResult> GetCarsByBrandId(int brandId) => new SuccessDataResult>(_carDal.GetAll(c => c.BrandId == brandId).ToList()); 60 | 61 | 62 | public IDataResult> GetCarsByColorId(int colorId) => new SuccessDataResult>(_carDal.GetAll(c => c.ColorId == colorId).ToList()); 63 | 64 | [CacheRemoveAspect("IProductService.Get")] 65 | public IResult Update(Car car) 66 | { 67 | _carDal.Update(car); 68 | return new SuccessResult(Messages.CarUpdated); 69 | } 70 | [CacheAspect] 71 | [PerformanceAspect(5)] 72 | public IDataResult GetById(int carId) 73 | { 74 | return new SuccessDataResult(_carDal.GetById(c => c.CarId == carId)); 75 | } 76 | 77 | public IDataResult> GetCarsByBrandIdAndColorId(int brandId, int colorId) 78 | { 79 | return new SuccessDataResult>(_carDal.GetAll(c => c.BrandId == brandId && c.ColorId == colorId).ToList()); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Business/Concrete/ColorManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Utilities.Results; 3 | using DataAccess.Abstract; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using Business.ValidationRules.FluentValidation; 9 | using Core.Aspects.Autofac.Caching; 10 | using Core.Aspects.Autofac.Validation; 11 | using Entities.DTOs; 12 | 13 | namespace Business.Concrete 14 | { 15 | public class ColorManager : IColorService 16 | { 17 | IColorDal _colorDal; 18 | 19 | public ColorManager(IColorDal colorDal) 20 | { 21 | _colorDal = colorDal; 22 | } 23 | 24 | 25 | //[CacheAspect] 26 | public IDataResult> GetAll() 27 | { 28 | return new SuccessDataResult>(_colorDal.GetAll()); 29 | } 30 | 31 | 32 | [CacheRemoveAspect("IColorService.Get")] 33 | public IResult Add(Color color) 34 | { 35 | _colorDal.Add(color); 36 | return new SuccessResult(); 37 | } 38 | 39 | [CacheRemoveAspect("IColorService.Get")] 40 | public IResult Update(Color color) 41 | { 42 | _colorDal.Update(color); 43 | return new SuccessResult(); 44 | } 45 | 46 | public IDataResult GetByColorId(int colorId) 47 | { 48 | return new SuccessDataResult(_colorDal.Get(co => co.ColorId == colorId)); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Business/Concrete/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 System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | 10 | namespace Business.Concrete 11 | { 12 | public class CustomerManager : ICustomerService 13 | { 14 | ICustomerDal _customerDal; 15 | public CustomerManager(ICustomerDal customerDal) 16 | { 17 | _customerDal = customerDal; 18 | } 19 | public IResult Add(Customer customer) 20 | { 21 | _customerDal.Add(customer); 22 | return new SuccessResult(Messages.CustomerAdded); 23 | } 24 | 25 | public IResult Delete(Customer customer) 26 | { 27 | _customerDal.Delete(customer); 28 | return new SuccessResult(Messages.CustomerDeleted); 29 | } 30 | 31 | public IDataResult> GetAll() 32 | { 33 | return new SuccessDataResult>(_customerDal.GetAll()); 34 | } 35 | 36 | public IResult Update(Customer customer) 37 | { 38 | _customerDal.Update(customer); 39 | return new SuccessResult(Messages.CustomerUpdated); 40 | } 41 | 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Business/Concrete/RentalManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.BusinessAspects.Autofac; 3 | using Business.Constants; 4 | using Core.Aspects.Autofac.Caching; 5 | using Core.Utilities.Results; 6 | using DataAccess.Abstract; 7 | using Entities.Concrete; 8 | using Entities.DTOs; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Text; 12 | 13 | namespace Business.Concrete 14 | { 15 | public class RentalManager : IRentalService 16 | { 17 | IRentalDal _rentalDal; 18 | 19 | public RentalManager(IRentalDal rentalDal) 20 | { 21 | _rentalDal = rentalDal; 22 | } 23 | 24 | public IResult CheckReturnDate(int carId) 25 | { 26 | 27 | var result = _rentalDal.GetRentalDetails(c => c.CarId == carId && c.ReturnDate == null); 28 | if (result.Count > 0) 29 | { 30 | return new ErrorResult(Messages.CarNotAvailable); 31 | } 32 | return new SuccessResult(Messages.CarAvailable); 33 | 34 | } 35 | 36 | public IDataResult> GetAll() 37 | { 38 | return new SuccessDataResult>(_rentalDal.GetAll()); 39 | } 40 | 41 | public IDataResult> GetRentalDetailsDto(int carId) 42 | { 43 | return new SuccessDataResult>(_rentalDal.GetRentalDetails(c => c.CarId == carId)); 44 | } 45 | 46 | [SecuredOperation("admin, product.add")] 47 | [CacheRemoveAspect("IRentalService.Get")] 48 | public IResult Add(Rental rental) 49 | { 50 | _rentalDal.Add(rental); 51 | return new SuccessResult(); 52 | 53 | } 54 | [CacheRemoveAspect("IBrandService.Get")] 55 | public IResult Update(Rental rental) 56 | { 57 | _rentalDal.Update(rental); 58 | return new SuccessResult(); 59 | } 60 | 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Business/Concrete/UserManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Core.Entities.Concrete; 4 | using Core.Utilities.Results; 5 | using DataAccess.Abstract; 6 | using Entities.Concrete; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | 11 | namespace Business.Concrete 12 | { 13 | public class UserManager : IUserService 14 | { 15 | IUserDal _userDal; 16 | 17 | public UserManager(IUserDal userDal) 18 | { 19 | _userDal = userDal; 20 | } 21 | 22 | public IResult Add(User user) 23 | { 24 | _userDal.Add(user); 25 | return new SuccessResult(Messages.UserAdded); 26 | } 27 | 28 | public IResult Delete(User user) 29 | { 30 | _userDal.Delete(user); 31 | return new SuccessResult(Messages.UserDeleted); 32 | } 33 | 34 | public IDataResult> GetAll() 35 | { 36 | return new SuccessDataResult>(_userDal.GetAll()); 37 | } 38 | 39 | public User GetByMail(string email) 40 | { 41 | return _userDal.Get(u => u.Email == email); 42 | } 43 | 44 | public List GetClaims(User user) 45 | { 46 | return _userDal.GetClaims(user); 47 | } 48 | 49 | public IResult Update(User user) 50 | { 51 | _userDal.Update(user); 52 | return new SuccessResult(Messages.UserUpdated); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Business/Constants/Messages.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.Serialization; 4 | using System.Text; 5 | 6 | namespace Business.Constants 7 | { 8 | public static class Messages 9 | { 10 | public static string CarAdded = "Araba Eklendi"; 11 | public static string CarDeleted = "Araba Kaydı Silindi"; 12 | public static string CarUpdated = "Araba Kaydı Güncellendi"; 13 | public static string CarsListed = "Arabalar Listelendi"; 14 | public static string CarNameInvalid = "Araba İsmi Geçersiz"; 15 | public static string CustomerAdded = "Yeni Müşteri Eklendi"; 16 | public static string CustomerDeleted = "Müşteri Kaydı Silindi"; 17 | public static string CustomerUpdated = "Müşteri Kaydı Güncellendi"; 18 | public static string UserAdded = "Yeni Kullanıcı Eklendi"; 19 | public static string UserDeleted = "Kullanıcı Kaydı Silindi"; 20 | public static string UserUpdated = "Kullanıcı Kaydı Güncellendi"; 21 | public static string CarAvailable = "Araç Müsait"; 22 | public static string CarNotAvailable = "Araç Müşteride"; 23 | public static string ImageNotAdded="Araç resmi eklenmedi"; 24 | public static string ImageAdded = "Araç resmi eklendi"; 25 | public static string CountOfCarImageError = "Araç resmi en fazla beş tane olabilir."; 26 | public static string ImageDeleted= "Araç resmi silindi"; 27 | public static string AuthorizationDenied="Yetkiniz yok"; 28 | public static string UserRegistered = "Kayıt oldu."; 29 | public static string UserNotFound = "Kullanıcı bulunamadı"; 30 | public static string PasswordError = "Parola hatası"; 31 | public static string SuccessfulLogin = "Başarılı giriş"; 32 | public static string UserAlreadyExists = "Kullanıcı mevcut"; 33 | public static string AccessTokenCreated = "Token oluşturuldu"; 34 | 35 | public static string Listed = "Listelendi"; 36 | 37 | public static string Deleted = "Silindi"; 38 | public static string CarImagesListed="Resimler listelendi"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Business/DependencyResolvers/Autofac/AutofacBusinessModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Extras.DynamicProxy; 3 | using Business.Abstract; 4 | using Business.Concrete; 5 | using Castle.DynamicProxy; 6 | using Core.Utilities.Interceptors; 7 | using Core.Utilities.Security.JWT; 8 | using DataAccess.Abstract; 9 | using DataAccess.Concrete.EntityFramework; 10 | using Microsoft.AspNetCore.Http; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using Module = Autofac.Module; 15 | 16 | namespace Business.DependencyResolvers.Autofac 17 | { 18 | public class AutofacBusinessModule : Module 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().SingleInstance(); 41 | builder.RegisterType().As().SingleInstance(); 42 | 43 | builder.RegisterType().As().SingleInstance(); 44 | builder.RegisterType().As().SingleInstance(); 45 | 46 | builder.RegisterType().As().SingleInstance(); 47 | 48 | var assembly = System.Reflection.Assembly.GetExecutingAssembly(); 49 | 50 | builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces() 51 | .EnableInterfaceInterceptors(new ProxyGenerationOptions() 52 | { 53 | Selector = new AspectInterceptorSelector() 54 | }).SingleInstance(); 55 | 56 | 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/CarImageValidator.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 | class CarImageValidator: AbstractValidator 10 | { 11 | public CarImageValidator() 12 | { 13 | RuleFor(p => p.CarId).NotEmpty(); 14 | RuleFor(p => p.ImagePath).NotEmpty(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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.CarName).NotEmpty(); 14 | RuleFor(c => c.CarName).MinimumLength(2); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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.Concrete; 2 | using Business.Constants; 3 | using DataAccess.Abstract; 4 | using DataAccess.Concrete; 5 | using DataAccess.Concrete.EntityFramework; 6 | using Entities.Concrete; 7 | using System; 8 | 9 | namespace ConsoleUI 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | //CarManager carManager = new CarManager(new EfCarDal()); 16 | 17 | //CarList(); 18 | //BringTheColorList(); 19 | //CarDetails(); 20 | //BrandIdCarLİst(); 21 | //ColorIdCarList(); 22 | //AddCar(); 23 | //UpdateCar(); 24 | //DeleteCar(); 25 | 26 | RentalManager rentalManager = new RentalManager(new EfRentalDal()); 27 | var result=rentalManager.GetRentalDetailsDto(1); 28 | if (result.Success == true) 29 | { 30 | foreach (var car in result.Data) 31 | { 32 | Console.WriteLine(car.CarName); 33 | } 34 | } 35 | else 36 | { 37 | Console.WriteLine(Messages.CarNotAvailable); 38 | } 39 | Console.ReadLine(); 40 | } 41 | 42 | private static void DeleteCar() 43 | { 44 | CarManager carManager = new CarManager(new EfCarDal()); 45 | carManager.Delete(new Car { CarId = 10 }); 46 | CarDetails(); 47 | } 48 | 49 | private static void UpdateCar() 50 | { 51 | CarManager carManager = new CarManager(new EfCarDal()); 52 | carManager.Update(new Car 53 | { 54 | CarId = 10, 55 | ColorId = 5 56 | }); 57 | CarDetails(); 58 | Console.WriteLine(); 59 | 60 | } 61 | 62 | private static void AddCar() 63 | { 64 | CarManager carManager = new CarManager(new EfCarDal()); 65 | Console.WriteLine("------Araç Ekleme------"); 66 | 67 | 68 | carManager.Add(new Car 69 | { 70 | BrandId = 2, 71 | CarName = "Peugeot", 72 | ColorId = 5, 73 | ModelYear = 2020, 74 | DailyPrice = 200, 75 | Description = " " 76 | }); 77 | 78 | carManager.Add(new Car 79 | { 80 | CarName = "Ab", 81 | BrandId = 2, 82 | ColorId = 1, 83 | DailyPrice = 0, 84 | Description = "Dizel", 85 | ModelYear = 2019 86 | }); 87 | } 88 | 89 | private static void ColorIdCarList() 90 | { 91 | CarManager carManager = new CarManager(new EfCarDal()); 92 | Console.WriteLine("\n------ColorId'ye göre------ "); 93 | foreach (var car in carManager.GetCarsByColorId(2).Data) 94 | { 95 | Console.WriteLine(car.CarName); 96 | } 97 | } 98 | 99 | private static void BrandIdCarLİst() 100 | { 101 | CarManager carManager = new CarManager(new EfCarDal()); 102 | Console.WriteLine("\n-----BrandId'ye göre-----"); 103 | foreach (var car in carManager.GetCarsByBrandId(1).Data) 104 | { 105 | Console.WriteLine(car.CarName); 106 | } 107 | } 108 | 109 | private static void CarDetails() 110 | { 111 | Console.WriteLine("Car Details: "); 112 | CarManager carManager = new CarManager(new EfCarDal()); 113 | var result = carManager.GetCarDetails(); 114 | if (result.Success == true) 115 | { 116 | foreach (var car in result.Data) 117 | { 118 | Console.WriteLine($"{car.CarId}.Araba : {car.CarName} / {car.BrandName} / {car.ColorName} / {car.DailyPrice}TL"); 119 | } 120 | } 121 | else 122 | { 123 | Console.WriteLine(result.Message); 124 | } 125 | 126 | } 127 | 128 | /// 129 | /// Araba listesini döner. 130 | /// 131 | private static void CarList() 132 | { 133 | Console.WriteLine("KİRALIK ARAÇ FİLOSU"); 134 | Console.WriteLine("----------------------------"); 135 | 136 | CarManager carManager = new CarManager(new EfCarDal()); 137 | foreach (var car in carManager.GetAll().Data) 138 | { 139 | Console.WriteLine($"Araç Bilgisi : {car.CarName} \n Id : {car.CarId} \n Marka : {car.BrandId} \n Renk : {car.ColorId}" + 140 | $" \n ModelYılı : {car.ModelYear} \n GünlükFiyat : {car.DailyPrice}TL \n Açıklama : {car.Description}"); 141 | Console.WriteLine("-----------------------------"); 142 | } 143 | Console.WriteLine(); 144 | } 145 | 146 | /// 147 | /// CarRental veritabanı-Colors Tablosundaki renkleri listeler. 148 | /// 149 | private static void BringTheColorList() 150 | { 151 | Console.WriteLine("Araba Renk Listesi: "); 152 | ColorManager colorManager = new ColorManager(new EfColorDal()); 153 | foreach (var color in colorManager.GetAll().Data) 154 | { 155 | Console.WriteLine(color.ColorName); 156 | } 157 | Console.WriteLine(); 158 | } 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /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 System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using Microsoft.Extensions.DependencyInjection; 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 | var key = $"{methodName}({string.Join(",", arguments.Select(arg => arg?.ToString() ?? ""))})"; 29 | if (_cacheManager.IsAdd(key)) 30 | { 31 | invocation.ReturnValue = _cacheManager.Get(key); 32 | return; 33 | } 34 | invocation.Proceed(); 35 | _cacheManager.Add(key, invocation.ReturnValue, _duration); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /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 System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using Microsoft.Extensions.DependencyInjection; 9 | 10 | namespace Core.Aspects.Autofac.Caching 11 | { 12 | public class CacheRemoveAspect : MethodInterception 13 | { 14 | private string _pattern; 15 | private ICacheManager _cacheManager; 16 | 17 | public CacheRemoveAspect(string pattern) 18 | { 19 | _pattern = pattern; 20 | _cacheManager = ServiceTool.ServiceProvider.GetService(); 21 | } 22 | 23 | protected override void OnSuccess(IInvocation invocation) 24 | { 25 | _cacheManager.RemoveByPattern(_pattern); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Performance/PerformanceAspect.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.IoC; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Text; 6 | using Microsoft.Extensions.DependencyInjection; 7 | using Castle.DynamicProxy; 8 | using Core.Utilities.Interceptors; 9 | 10 | namespace Core.Aspects.Autofact.Performance 11 | { 12 | public class PerformanceAspect : MethodInterception 13 | { 14 | int _interval; 15 | Stopwatch _stopwatch; 16 | 17 | public PerformanceAspect(int interval) 18 | { 19 | _interval = interval; 20 | _stopwatch = ServiceTool.ServiceProvider.GetService(); 21 | } 22 | 23 | protected override void OnBefore(IInvocation invocation) 24 | { 25 | _stopwatch.Start(); 26 | } 27 | 28 | protected override void OnAfter(IInvocation invocation) 29 | { 30 | if (_stopwatch.Elapsed.TotalSeconds > _interval) 31 | { 32 | Debug.WriteLine($"Performance: {invocation.Method.DeclaringType.FullName}.{invocation.Method.Name}-->{_stopwatch.Elapsed.TotalSeconds}"); 33 | } 34 | _stopwatch.Reset(); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Transaction/TransactionScopeAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.Utilities.Interceptors; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using System.Transactions; 7 | 8 | namespace Core.Aspects.Autofac.Transaction 9 | { 10 | public class TransactionScopeAspect : MethodInterception 11 | { 12 | public override void Intercept(IInvocation invocation) 13 | { 14 | using (TransactionScope transactionScope = new TransactionScope()) 15 | { 16 | try 17 | { 18 | invocation.Proceed(); 19 | transactionScope.Complete(); 20 | } 21 | catch (System.Exception e) 22 | { 23 | transactionScope.Dispose(); 24 | throw; 25 | } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /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 | var entities = invocation.Arguments.Where(t => t.GetType() == entityType); 29 | foreach (var entity in entities) 30 | { 31 | ValidationTool.Validate(validator, entity); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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 | void Remove(string key); 14 | void RemoveByPattern(string pattern); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Caching/Microsoft/MemoryCacheManager.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.IoC; 2 | using Microsoft.Extensions.Caching.Memory; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using Microsoft.Extensions.DependencyInjection; 7 | using System.Text.RegularExpressions; 8 | using System.Linq; 9 | 10 | namespace Core.CrossCuttingConcerns.Caching.Microsoft 11 | { 12 | public class MemoryCacheManager : ICacheManager 13 | { 14 | IMemoryCache _memoryCache; 15 | public MemoryCacheManager() 16 | { 17 | _memoryCache = ServiceTool.ServiceProvider.GetService(); 18 | } 19 | public void Add(string key, object value, int duration) 20 | { 21 | _memoryCache.Set(key, value, TimeSpan.FromMinutes(duration)); 22 | } 23 | 24 | public T Get(string key) 25 | { 26 | return _memoryCache.Get(key); 27 | } 28 | 29 | public object Get(string key) 30 | { 31 | return _memoryCache.Get(key); 32 | } 33 | 34 | public bool IsAdd(string key) 35 | { 36 | return _memoryCache.TryGetValue(key, out _); 37 | } 38 | 39 | public void Remove(string key) 40 | { 41 | _memoryCache.Remove(key); 42 | } 43 | 44 | public void RemoveByPattern(string pattern) 45 | { 46 | var cacheEntriesCollectionDefinition = typeof(MemoryCache).GetProperty("EntriesCollection", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); 47 | var cacheEntriesCollection = cacheEntriesCollectionDefinition.GetValue(_memoryCache) as dynamic; 48 | List cacheCollectionValues = new List(); 49 | 50 | foreach (var cacheItem in cacheEntriesCollection) 51 | { 52 | ICacheEntry cacheItemValue = cacheItem.GetType().GetProperty("Value").GetValue(cacheItem, null); 53 | cacheCollectionValues.Add(cacheItemValue); 54 | } 55 | 56 | var regex = new Regex(pattern, RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase); 57 | var keysToRemove = cacheCollectionValues.Where(d => regex.IsMatch(d.Key.ToString())).Select(d => d.Key).ToList(); 58 | 59 | foreach (var key in keysToRemove) 60 | { 61 | _memoryCache.Remove(key); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /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 | if (!result.IsValid) 15 | { 16 | throw new ValidationException(result.Errors); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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 | 18 | using (TContext context = new TContext()) 19 | { 20 | 21 | var addedEntity = context.Entry(entity); 22 | addedEntity.State = EntityState.Added; 23 | context.SaveChanges(); 24 | } 25 | } 26 | 27 | public void Delete(TEntity entity) 28 | { 29 | using (TContext context = new TContext()) 30 | { 31 | //context.Set().Remove(context.Set().SingleOrDefault(filter)); 32 | 33 | var deleteEntity = context.Entry(entity); 34 | deleteEntity.State = EntityState.Deleted; 35 | 36 | context.SaveChanges(); 37 | } 38 | } 39 | 40 | public TEntity Get(Expression> filter) 41 | { 42 | using (TContext context = new TContext()) 43 | { 44 | return context.Set().SingleOrDefault(filter); 45 | } 46 | } 47 | 48 | public List GetAll(Expression> filter = null) 49 | { 50 | using (TContext context = new TContext()) 51 | { 52 | return filter == null ? context.Set().ToList() : context.Set().Where(filter).ToList(); 53 | } 54 | } 55 | 56 | public TEntity GetById(Expression> filter) 57 | { 58 | throw new NotImplementedException(); 59 | } 60 | 61 | public void Update(TEntity entity) 62 | { 63 | using (TContext context = new TContext()) 64 | { 65 | var updatedEntity = context.Entry(entity); 66 | updatedEntity.State = EntityState.Modified; 67 | context.SaveChanges(); 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /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 | T GetById(Expression> filter); 11 | List GetAll(Expression> filter=null); 12 | T Get(Expression> filter); 13 | void Add(T entity); 14 | void Update(T entity); 15 | void Delete(T entity); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Core/DependencyResolvers/CoreModule.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.IoC; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using Microsoft.AspNetCore.Http; 7 | using Core.CrossCuttingConcerns.Caching; 8 | using Core.CrossCuttingConcerns.Caching.Microsoft; 9 | using System.Diagnostics; 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 | serviceCollection.AddSingleton(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/OperationClaim.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Entities.Concrete 2 | { 3 | public class OperationClaim:IEntity 4 | { 5 | public int Id { get; set; } 6 | public string Name { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /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 UserId { 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 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/UserOperationClaim.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Entities.Concrete 2 | { 3 | public class UserOperationClaim:IEntity 4 | { 5 | public int Id { get; set; } 6 | public int UserId { get; set; } 7 | public int OperationClaimId { get; set; } 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Core/Entities/IDto.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Entites 2 | { 3 | public interface IDto 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Core/Extensions/ClaimExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IdentityModel.Tokens.Jwt; 4 | using System.Linq; 5 | using System.Security.Claims; 6 | using System.Text; 7 | 8 | namespace Core.Extensions 9 | { 10 | public static class ClaimExtensions 11 | { 12 | public static void AddEmail(this ICollection claims, string email) 13 | { 14 | claims.Add(new Claim(JwtRegisteredClaimNames.Email, email)); 15 | } 16 | 17 | public static void AddName(this ICollection claims, string name) 18 | { 19 | claims.Add(new Claim(ClaimTypes.Name, name)); 20 | } 21 | 22 | public static void AddNameIdentifier(this ICollection claims, string nameIdentifier) 23 | { 24 | claims.Add(new Claim(ClaimTypes.NameIdentifier, nameIdentifier)); 25 | } 26 | 27 | public static void AddRoles(this ICollection claims, string[] roles) 28 | { 29 | roles.ToList().ForEach(role => claims.Add(new Claim(ClaimTypes.Role, role))); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Core/Extensions/ClaimsPrincipalExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Claims; 5 | using System.Text; 6 | 7 | namespace Core.Extensions 8 | { 9 | public static class ClaimsPrincipalExtensions 10 | { 11 | public static List Claims(this ClaimsPrincipal claimsPrincipal, string claimType) 12 | { 13 | var result = claimsPrincipal?.FindAll(claimType)?.Select(x => x.Value).ToList(); 14 | return result; 15 | } 16 | 17 | public static List ClaimRoles(this ClaimsPrincipal claimsPrincipal) 18 | { 19 | return claimsPrincipal?.Claims(ClaimTypes.Role); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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 | module.Load(serviceCollection); 17 | } 18 | return ServiceTool.Create(serviceCollection); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /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 | return null; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/AspectInterceptorSelector.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | 8 | namespace Core.Utilities.Interceptors 9 | { 10 | 11 | public class AspectInterceptorSelector : IInterceptorSelector 12 | { 13 | public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors) 14 | { 15 | var classAttributes = type.GetCustomAttributes 16 | (true).ToList(); 17 | var methodAttributes = type.GetMethod(method.Name) 18 | .GetCustomAttributes(true); 19 | classAttributes.AddRange(methodAttributes); 20 | 21 | 22 | return classAttributes.OrderBy(x => x.Priority).ToArray(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | public T Data { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | } 17 | -------------------------------------------------------------------------------- /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 10 | (string password, out byte[] passwordHash, out byte[] passwordSalt) 11 | { 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.UserId.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 | -------------------------------------------------------------------------------- /Core/Utilities/Uploads/FileHelper/FileHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Threading; 4 | using Core.Utilities.Results; 5 | using Microsoft.AspNetCore.Http; 6 | 7 | namespace Core.Utilities.Uploads.ImageUploads 8 | { 9 | public class FileHelper 10 | { 11 | static string directory = Directory.GetCurrentDirectory() + @"\wwwroot\"; 12 | static string path = @"\Images\"; 13 | 14 | public static string Add(IFormFile file) 15 | { 16 | string extension = Path.GetExtension(file.FileName); 17 | string newFileName = Guid.NewGuid().ToString("N") + extension; 18 | 19 | if (!Directory.Exists(directory + path)) 20 | { 21 | Directory.CreateDirectory(directory + path); 22 | } 23 | 24 | using (FileStream fileStream = File.Create(directory + path + newFileName)) 25 | { 26 | file.CopyTo(fileStream); 27 | fileStream.Flush(); 28 | } 29 | 30 | 31 | return (path + newFileName).Replace("\\", "/"); 32 | } 33 | 34 | 35 | 36 | public static void Delete(string imagePath) 37 | { 38 | if (File.Exists(directory + imagePath.Replace("/", "\\")) && Path.GetFileName(imagePath) != "image.bmp") 39 | { 40 | File.Delete(directory + imagePath.Replace("/", "\\")); 41 | } 42 | } 43 | 44 | 45 | public static string Update(IFormFile file, string oldImagePath) 46 | { 47 | Delete(oldImagePath); 48 | return Add(file); 49 | 50 | 51 | } 52 | 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | } 15 | } 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICustomerDal.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 ICustomerDal :IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /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.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace DataAccess.Abstract 10 | { 11 | public interface IRentalDal :IEntityRepository 12 | { 13 | List GetRentalDetails(Expression> filter = null); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 2 | using Core.Entities.Concrete; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Abstract 9 | { 10 | public interface IUserDal: IEntityRepository 11 | { 12 | List GetClaims(User user); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/CarRentalContext.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.Concrete.EntityFramework 9 | { 10 | public class CarRentalContext : DbContext 11 | { 12 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 13 | { 14 | optionsBuilder.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=CarRental;Trusted_Connection=true"); 15 | } 16 | public DbSet Cars { get; set; } 17 | public DbSet Brands { get; set; } 18 | public DbSet Colors { get; set; } 19 | public DbSet Customers { get; set; } 20 | public DbSet Users { get; set; } 21 | public DbSet Rentals { get; set; } 22 | public DbSet CarImages { get; set; } 23 | public DbSet OperationClaims { get; set; } 24 | public DbSet UserOperationClaims { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfBrandDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 2 | using Core.DataAccess.EntityFramework; 3 | using DataAccess.Abstract; 4 | using Entities.Concrete; 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.Concrete.EntityFramework 13 | { 14 | public class EfBrandDal : EfEntityRepositoryBase,IBrandDal 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCarDal.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.Concrete.EntityFramework 13 | { 14 | public class EfCarDal : EfEntityRepositoryBase, ICarDal 15 | { 16 | public List GetCarDetails(Expression> filter=null) 17 | { 18 | using (CarRentalContext context=new CarRentalContext()) 19 | { 20 | var result = from c in context.Cars 21 | join b in context.Brands on c.BrandId equals b.BrandId 22 | join co in context.Colors on c.ColorId equals co.ColorId 23 | //join i in context.CarImages on c.CarId equals i.CarId 24 | select new CarDetailDto 25 | { 26 | CarId = c.CarId, 27 | BrandId = b.BrandId, 28 | ColorId = co.ColorId, 29 | CarName = c.CarName, 30 | BrandName = b.BrandName, 31 | ColorName = co.ColorName, 32 | ModelYear = c.ModelYear, 33 | Description = c.Description, 34 | DailyPrice = c.DailyPrice, 35 | //ImagePath = i.ImagePath, 36 | ImagePath = (from i in context.CarImages where i.CarId == c.CarId select i.ImagePath).ToList(), 37 | 38 | }; 39 | return result.ToList(); 40 | 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DataAccess/Concrete/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.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework 9 | { 10 | public class EfCarImageDal: EfEntityRepositoryBase,ICarImageDal 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfColorDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 2 | using Core.DataAccess.EntityFramework; 3 | using DataAccess.Abstract; 4 | using Entities.Concrete; 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.Concrete.EntityFramework 13 | { 14 | public class EfColorDal : EfEntityRepositoryBase, IColorDal 15 | { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCustomerDal.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.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework 9 | { 10 | public class EfCustomerDal :EfEntityRepositoryBase,ICustomerDal 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Concrete/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 | using System.Linq.Expressions; 10 | using System.Text; 11 | 12 | namespace DataAccess.Concrete.EntityFramework 13 | { 14 | public class EfRentalDal : EfEntityRepositoryBase, IRentalDal 15 | { 16 | 17 | public List GetRentalDetails(Expression> filter = null) 18 | { 19 | using (CarRentalContext context =new CarRentalContext()) 20 | { 21 | var result = from r in context.Rentals 22 | join cu in context.Customers on r.CustomerId equals cu.CustomerId 23 | join ca in context.Cars on r.CarId equals ca.CarId 24 | join u in context.Users on cu.UserID equals u.UserId 25 | 26 | select new RentalDetailDto 27 | { 28 | CarId=ca.CarId, 29 | CarName=ca.CarName, 30 | UserId=u.UserId, 31 | CustomerId=cu.CustomerId, 32 | FirstName=u.FirstName, 33 | LastName=u.LastName, 34 | CompanyName=cu.CompanyName, 35 | RentDate=r.RentDate, 36 | ReturnDate=r.ReturnDate 37 | }; 38 | return result.ToList(); 39 | 40 | } 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using Core.Entities.Concrete; 3 | using DataAccess.Abstract; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using System.Linq; 9 | 10 | namespace DataAccess.Concrete.EntityFramework 11 | { 12 | public class EfUserDal : EfEntityRepositoryBase, IUserDal 13 | { 14 | public List GetClaims(User user) 15 | { 16 | using (var context = new CarRentalContext()) 17 | { 18 | var result = from operationClaim in context.OperationClaims 19 | join userOperationClaim in context.UserOperationClaims 20 | on operationClaim.Id equals userOperationClaim.OperationClaimId 21 | where userOperationClaim.UserId == user.UserId 22 | select new OperationClaim { Id = operationClaim.Id, Name = operationClaim.Name }; 23 | return result.ToList(); 24 | 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DataAccess/Concrete/InMemory/InMemoryCarDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 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 | using System.Text; 10 | 11 | namespace DataAccess.Concrete 12 | { 13 | public class InMemoryCarDal : ICarDal 14 | { 15 | List _cars; 16 | public InMemoryCarDal() 17 | { 18 | _cars = new List 19 | { 20 | new Car{CarId=1,BrandId=1,ColorId=1,ModelYear=2018,DailyPrice=150,Description="Manuel Vites"}, 21 | new Car{CarId=2,BrandId=1,ColorId=3,ModelYear=2016,DailyPrice=100,Description="Otomatik vites"}, 22 | new Car{CarId=3,BrandId=2,ColorId=2,ModelYear=2020,DailyPrice=250,Description="Manuel Vites"}, 23 | new Car{CarId=4,BrandId=2,ColorId=4,ModelYear=2019,DailyPrice=200,Description="Benzin,Otomatik vites"}, 24 | new Car{CarId=5,BrandId=3,ColorId=2,ModelYear=2020,DailyPrice=200,Description="Dizel Motor,Manuel Vites"}, 25 | new Car{CarId=6,BrandId=4,ColorId=3,ModelYear=2016,DailyPrice=150,Description="Benzin,Otomatik vites"}, 26 | new Car{CarId=7,BrandId=4,ColorId=1,ModelYear=2018,DailyPrice=200,Description="Dizel Motor,Manuel Vites"}, 27 | new Car{CarId=8,BrandId=5,ColorId=1,ModelYear=2019,DailyPrice=200,Description="Benzin,Otomatik vites"} 28 | }; 29 | } 30 | /// 31 | /// Sisteme araba kaydı ekler. 32 | /// 33 | /// 34 | public void Add(Car car) => _cars.Add(car); 35 | 36 | /// 37 | /// Sistemden araba kaydı siler 38 | /// 39 | /// 40 | public void Delete(Car car) 41 | { 42 | Car carToDelete = _cars.FirstOrDefault(c => c.CarId == car.CarId); 43 | 44 | _cars.Remove(carToDelete); 45 | } 46 | 47 | public Car Get(Expression> filter) 48 | { 49 | throw new NotImplementedException(); 50 | } 51 | 52 | /// 53 | /// Sistemdeki arabaların hepsini listeler. 54 | /// 55 | /// Araba Listesi 56 | public List GetAll() 57 | { 58 | return _cars; 59 | } 60 | 61 | public List GetAll(Expression> filter = null) 62 | { 63 | throw new NotImplementedException(); 64 | } 65 | 66 | /// 67 | /// Sisteme kayıtlı olan arabaları Id numarasına göre listeler. 68 | /// 69 | /// Araba Id'si 70 | /// 71 | public List GetById(int id) 72 | { 73 | return _cars.Where(c => c.CarId == id).ToList(); 74 | } 75 | 76 | public List GetById(Expression> filter) 77 | { 78 | throw new NotImplementedException(); 79 | } 80 | 81 | public List GetCarDetails() 82 | { 83 | throw new NotImplementedException(); 84 | } 85 | 86 | public List GetCarDetails(Expression> filter = null) 87 | { 88 | throw new NotImplementedException(); 89 | } 90 | 91 | /// 92 | /// Sisteme kayıtlı olan araba bilgilerini günceller. 93 | /// 94 | /// 95 | public void Update(Car car) 96 | { 97 | Car carToUpdate = _cars.FirstOrDefault(c=> car.CarId == car.CarId); 98 | carToUpdate.BrandId = car.BrandId; 99 | carToUpdate.ColorId = car.ColorId; 100 | carToUpdate.ModelYear = car.ModelYear; 101 | carToUpdate.DailyPrice = car.DailyPrice; 102 | carToUpdate.Description = car.Description; 103 | } 104 | 105 | Car IEntityRepository.GetById(Expression> filter) 106 | { 107 | throw new NotImplementedException(); 108 | } 109 | 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /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 | namespace Entities.Concrete 3 | { 4 | public class Brand :IEntity 5 | { 6 | public int BrandId { get; set; } 7 | public string BrandName { get; set; } 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Entities/Concrete/Car.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | namespace Entities.Concrete 3 | { 4 | public class Car : IEntity 5 | { 6 | public int CarId { get; set; } 7 | public string CarName { get; set; } 8 | public int BrandId { get; set; } 9 | public int ColorId { get; set; } 10 | public int ModelYear { get; set; } 11 | public decimal DailyPrice { get; set; } 12 | public string Description { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Entities/Concrete/CarImage.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Text; 6 | 7 | namespace Entities.Concrete 8 | { 9 | public class CarImage :IEntity 10 | { 11 | [Key] 12 | public int CarImageId { get; set; } 13 | public int CarId { get; set; } 14 | public string ImagePath { get; set; } 15 | public DateTime Date { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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 | public string ColorName { get; set; } 12 | 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 CustomerId { get; set; } 11 | public int UserID { get; set; } 12 | public string CompanyName { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /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 | public int CarId { get; set; } 12 | public int CustomerId { get; set; } 13 | public DateTime RentDate { get; set; } 14 | public DateTime ReturnDate { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Entities/DTOs/CarDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entites; 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 | public int BrandId { get; set; } 12 | public int ColorId { get; set; } 13 | public string CarName { get; set; } 14 | public string BrandName { get; set; } 15 | public string ColorName { get; set; } 16 | public decimal DailyPrice { get; set; } 17 | public int ModelYear { get; set; } 18 | public string Description { get; set; } 19 | public List ImagePath { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Entities/DTOs/RentalDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entites; 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 CustomerId { get; set; } 11 | public int UserId { get; set; } 12 | public int CarId { get; set; } 13 | public string CarName { get; set; } 14 | public string FirstName { get; set; } 15 | public string LastName { get; set; } 16 | public string CompanyName { get; set; } 17 | public DateTime RentDate { get; set; } 18 | public DateTime ReturnDate { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Entities/DTOs/UserForLoginDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entites; 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.Entites; 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/Entities.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ReCapProject.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30907.101 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataAccess", "DataAccess\DataAccess.csproj", "{1ACF9651-18D6-4052-AD69-05ED35C9AA1C}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Business", "Business\Business.csproj", "{7599C500-43FF-4731-A82C-3021CC9A20B3}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Entities", "Entities\Entities.csproj", "{8919C3A6-B6AF-4567-9247-2F8015D3159A}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleUI", "ConsoleUI\ConsoleUI.csproj", "{C5E7E8D5-82E5-42D2-B79B-B55883B4CFDF}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{92904FF7-49C8-4F73-9514-9EE07C4F253C}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPI", "WebAPI\WebAPI.csproj", "{B2358392-351A-40F7-87EB-982F1C819CB9}" 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 | {1ACF9651-18D6-4052-AD69-05ED35C9AA1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {1ACF9651-18D6-4052-AD69-05ED35C9AA1C}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {1ACF9651-18D6-4052-AD69-05ED35C9AA1C}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {1ACF9651-18D6-4052-AD69-05ED35C9AA1C}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {7599C500-43FF-4731-A82C-3021CC9A20B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {7599C500-43FF-4731-A82C-3021CC9A20B3}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {7599C500-43FF-4731-A82C-3021CC9A20B3}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {7599C500-43FF-4731-A82C-3021CC9A20B3}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {8919C3A6-B6AF-4567-9247-2F8015D3159A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {8919C3A6-B6AF-4567-9247-2F8015D3159A}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {8919C3A6-B6AF-4567-9247-2F8015D3159A}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {8919C3A6-B6AF-4567-9247-2F8015D3159A}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {C5E7E8D5-82E5-42D2-B79B-B55883B4CFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {C5E7E8D5-82E5-42D2-B79B-B55883B4CFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {C5E7E8D5-82E5-42D2-B79B-B55883B4CFDF}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {C5E7E8D5-82E5-42D2-B79B-B55883B4CFDF}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {92904FF7-49C8-4F73-9514-9EE07C4F253C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {92904FF7-49C8-4F73-9514-9EE07C4F253C}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {92904FF7-49C8-4F73-9514-9EE07C4F253C}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {92904FF7-49C8-4F73-9514-9EE07C4F253C}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {B2358392-351A-40F7-87EB-982F1C819CB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {B2358392-351A-40F7-87EB-982F1C819CB9}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {B2358392-351A-40F7-87EB-982F1C819CB9}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {B2358392-351A-40F7-87EB-982F1C819CB9}.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 = {4CABE032-8812-4BA2-B436-05399D2090BD} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /WebAPI/Controllers/AuthController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.DTOs; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace WebAPI.Controllers 10 | { 11 | [Route("api/[controller]")] 12 | [ApiController] 13 | public class AuthController : ControllerBase 14 | { 15 | private IAuthService _authService; 16 | 17 | public AuthController(IAuthService authService) 18 | { 19 | _authService = authService; 20 | } 21 | 22 | [HttpPost("login")] 23 | public ActionResult Login(UserForLoginDto userForLoginDto) 24 | { 25 | var userToLogin = _authService.Login(userForLoginDto); 26 | if (!userToLogin.Success) 27 | { 28 | return BadRequest(userToLogin.Message); 29 | } 30 | 31 | var result = _authService.CreateAccessToken(userToLogin.Data); 32 | if (result.Success) 33 | { 34 | return Ok(result.Data); 35 | } 36 | 37 | return BadRequest(result.Message); 38 | } 39 | 40 | [HttpPost("register")] 41 | public IActionResult Register(UserForRegisterDto userForRegisterDto) 42 | { 43 | var userExists = _authService.UserExists(userForRegisterDto.Email); 44 | if (!userExists.Success) 45 | { 46 | return BadRequest(userExists.Message); 47 | } 48 | 49 | var registerResult = _authService.Register(userForRegisterDto, userForRegisterDto.Password); 50 | var result = _authService.CreateAccessToken(registerResult.Data); 51 | if (result.Success) 52 | { 53 | return Ok(result.Data); 54 | } 55 | 56 | return BadRequest(result.Message); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /WebAPI/Controllers/BrandsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class BrandsController : ControllerBase 15 | { 16 | IBrandService _brandService; 17 | 18 | public BrandsController(IBrandService brandService) 19 | { 20 | _brandService = brandService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _brandService.GetAll(); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | [HttpPost("add")] 34 | public IActionResult Add(Brand brand) 35 | { 36 | var result = _brandService.Add(brand); 37 | if (result.Success) 38 | { 39 | return Ok(result); 40 | } 41 | return BadRequest(result); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarImagesController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using Microsoft.AspNetCore.Mvc; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using Business.Abstract; 8 | using Entities.Concrete; 9 | using Microsoft.AspNetCore.Hosting; 10 | using System.IO; 11 | using Core.Utilities.Results; 12 | using Core.Utilities.Business; 13 | 14 | namespace WebAPI.Controllers 15 | { 16 | [Route("api/[controller]")] 17 | [ApiController] 18 | public class CarImagesController : ControllerBase 19 | { 20 | ICarImageService _imageService; 21 | 22 | public CarImagesController(ICarImageService imageService) 23 | { 24 | _imageService = imageService; 25 | } 26 | 27 | [HttpGet("getall")] 28 | public IActionResult GetAll() 29 | { 30 | var result = _imageService.GetAll(); 31 | if (result.Success) 32 | { 33 | return Ok(result); 34 | } 35 | return BadRequest(result); 36 | } 37 | [HttpGet("getimagesbycarid")] 38 | public IActionResult GetImagesById(int carId) 39 | { 40 | var result = _imageService.GetImagesByCarId(carId); 41 | if (result.Success) 42 | { 43 | return Ok(result); 44 | } 45 | return BadRequest(result); 46 | } 47 | 48 | [HttpGet("getbyid")] 49 | public IActionResult GetById(int imageId) 50 | { 51 | var result = _imageService.GetById(imageId); 52 | if (result.Success) 53 | { 54 | return Ok(result); 55 | } 56 | return BadRequest(result); 57 | } 58 | 59 | 60 | 61 | [HttpPost("add")] 62 | public IActionResult Add([FromForm] IFormFile[] files, [FromForm] CarImage carImage) 63 | { 64 | var result = _imageService.AddCollective(files, carImage); 65 | if (result.Success) 66 | { 67 | return Ok(result); 68 | } 69 | 70 | return BadRequest(result); 71 | } 72 | 73 | [HttpPost("update")] 74 | public IActionResult Update([FromForm] IFormFile file, [FromForm] CarImage carImage) 75 | { 76 | var result = _imageService.Update(file, carImage); 77 | if (result.Success) 78 | { 79 | return Ok(result); 80 | } 81 | return BadRequest(result); 82 | } 83 | 84 | [HttpPost("delete")] 85 | public IActionResult Delete(CarImage carImage) 86 | { 87 | var result = _imageService.Delete(carImage); 88 | if (result.Success) 89 | { 90 | return Ok(result); 91 | } 92 | return BadRequest(result); 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /WebAPI/Controllers/CarsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Concrete; 3 | using DataAccess.Concrete.EntityFramework; 4 | using Entities.Concrete; 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Http; 7 | using Microsoft.AspNetCore.Mvc; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace WebAPI.Controllers 15 | { 16 | [Route("api/[controller]")] 17 | [ApiController] 18 | public class CarsController : ControllerBase 19 | { 20 | ICarService _carService; 21 | 22 | public CarsController(ICarService carService) 23 | { 24 | _carService = carService; 25 | } 26 | 27 | [HttpGet("getall")] 28 | // [Authorize(Roles ="Car.List")] 29 | public IActionResult GetAll() 30 | { 31 | Thread.Sleep(1000); 32 | 33 | var result = _carService.GetAll(); 34 | if (result.Success) 35 | { 36 | return Ok(result); 37 | } 38 | return BadRequest(result); 39 | } 40 | 41 | [HttpGet("getbyid")] 42 | public IActionResult GetById(int carId) 43 | { 44 | var result = _carService.GetById(carId); 45 | if (result.Success) 46 | { 47 | return Ok(result); 48 | } 49 | return BadRequest(result); 50 | } 51 | 52 | [HttpGet("getcarsbybrandid")] 53 | public IActionResult GetCarsByBrandId(int brandId) 54 | { 55 | var result = _carService.GetCarsByBrandId(brandId); 56 | if (result.Success) 57 | { 58 | return Ok(result); 59 | } 60 | return BadRequest(result); 61 | } 62 | 63 | [HttpGet("getcarsbycolorid")] 64 | public IActionResult GetCarsByColorId(int colorId) 65 | { 66 | var result = _carService.GetCarsByColorId(colorId); 67 | if (result.Success) 68 | { 69 | return Ok(result); 70 | } 71 | return BadRequest(result); 72 | } 73 | [HttpGet("getcarsbybrandidandcolorid")] 74 | public IActionResult GetCarsByBrandIdAndColorId(int brandId,int colorId) 75 | { 76 | var result = _carService.GetCarsByBrandIdAndColorId(brandId, colorId); 77 | if (result.Success) 78 | { 79 | return Ok(result); 80 | } 81 | return BadRequest(result); 82 | } 83 | 84 | [HttpGet("getcardetails")] 85 | public IActionResult GetCarDetails() 86 | { 87 | var result = _carService.GetCarDetails(); 88 | if (result.Success) 89 | { 90 | return Ok(result); 91 | } 92 | return BadRequest(result); 93 | } 94 | 95 | [HttpGet("getcardetailsbycarid")] 96 | public IActionResult GetCarDetailsByCarId(int carId) 97 | { 98 | var result = _carService.GetCarDetailsByCarId(carId); 99 | if (result.Success) 100 | { 101 | return Ok(result); 102 | } 103 | return BadRequest(result); 104 | } 105 | 106 | [HttpPost("add")] 107 | public IActionResult Add(Car car) 108 | { 109 | var result = _carService.Add(car); 110 | if (result.Success) 111 | { 112 | return Ok(result); 113 | } 114 | return BadRequest(result); 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /WebAPI/Controllers/ColorsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Microsoft.AspNetCore.Http; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace WebAPI.Controllers 10 | { 11 | [Route("api/[controller]")] 12 | [ApiController] 13 | public class ColorsController : ControllerBase 14 | { 15 | IColorService _colorService; 16 | 17 | public ColorsController(IColorService colorService) 18 | { 19 | _colorService = colorService; 20 | } 21 | 22 | [HttpGet("getall")] 23 | public IActionResult GetAll() 24 | { 25 | var result = _colorService.GetAll(); 26 | if (result.Success) 27 | { 28 | return Ok(result); 29 | } 30 | return BadRequest(result); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CustomersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class CustomersController : ControllerBase 15 | { 16 | ICustomerService _customerService; 17 | 18 | public CustomersController(ICustomerService customerService) 19 | { 20 | _customerService = customerService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _customerService.GetAll(); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | 34 | [HttpPost("add")] 35 | public IActionResult Add(Customer customer) 36 | { 37 | var result = _customerService.Add(customer); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | return BadRequest(result); 43 | } 44 | 45 | [HttpPost("update")] 46 | public IActionResult Update(Customer customer) 47 | { 48 | var result = _customerService.Add(customer); 49 | if (result.Success) 50 | { 51 | return Ok(result); 52 | } 53 | return BadRequest(result); 54 | } 55 | 56 | [HttpPost("delete")] 57 | public IActionResult Delete(Customer customer) 58 | { 59 | var result = _customerService.Add(customer); 60 | if (result.Success) 61 | { 62 | return Ok(result); 63 | } 64 | return BadRequest(result); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /WebAPI/Controllers/RentalsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class RentalsController : ControllerBase 15 | { 16 | IRentalService _rentalService; 17 | 18 | public RentalsController(IRentalService rentalService) 19 | { 20 | _rentalService = rentalService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _rentalService.GetAll(); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | 34 | [HttpGet("getrentaldetailsdto")] 35 | public IActionResult GetRentalDetailsDto(int carId) 36 | { 37 | var result = _rentalService.GetRentalDetailsDto(carId); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | return BadRequest(result); 43 | } 44 | 45 | [HttpPost("checkreturndate")] 46 | public IActionResult CheckReturnDate(int carId) 47 | { 48 | var result = _rentalService.CheckReturnDate(carId); 49 | if (result.Success) 50 | { 51 | return Ok(result); 52 | } 53 | return BadRequest(result); 54 | } 55 | [HttpPost("add")] 56 | public IActionResult Add(Rental rental) 57 | { 58 | var result = _rentalService.Add(rental); 59 | if (result.Success) 60 | { 61 | return Ok(result); 62 | } 63 | return BadRequest(result); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /WebAPI/Controllers/UsersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Entities.Concrete; 3 | using Entities.Concrete; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.AspNetCore.Mvc; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Threading.Tasks; 10 | 11 | namespace WebAPI.Controllers 12 | { 13 | [Route("api/[controller]")] 14 | [ApiController] 15 | public class UsersController : ControllerBase 16 | { 17 | IUserService _userService; 18 | 19 | public UsersController(IUserService userService) 20 | { 21 | _userService = userService; 22 | } 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _userService.GetAll(); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | 34 | [HttpPost("add")] 35 | public IActionResult Add(User user) 36 | { 37 | var result = _userService.Add(user); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | return BadRequest(result); 43 | } 44 | 45 | [HttpPost("update")] 46 | public IActionResult Update(User user) 47 | { 48 | var result = _userService.Add(user); 49 | if (result.Success) 50 | { 51 | return Ok(result); 52 | } 53 | return BadRequest(result); 54 | } 55 | 56 | [HttpPost("delete")] 57 | public IActionResult Delete(User user) 58 | { 59 | var result = _userService.Add(user); 60 | if (result.Success) 61 | { 62 | return Ok(result); 63 | } 64 | return BadRequest(result); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /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/Images/ImageUpload.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace WebAPI.Images 8 | { 9 | public class ImageUpload 10 | { 11 | public IFormFile images { get; set; } 12 | public IFormFile carId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /WebAPI/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.Hosting; 4 | using Microsoft.Extensions.Logging; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | using Autofac; 10 | using Autofac.Extensions.DependencyInjection; 11 | using Business.DependencyResolvers; 12 | using Castle.DynamicProxy; 13 | using Business.DependencyResolvers.Autofac; 14 | 15 | namespace WebAPI 16 | { 17 | public class Program 18 | { 19 | public static void Main(string[] args) 20 | { 21 | CreateHostBuilder(args).Build().Run(); 22 | } 23 | 24 | public static IHostBuilder CreateHostBuilder(string[] args) => 25 | Host.CreateDefaultBuilder(args) 26 | .UseServiceProviderFactory(new AutofacServiceProviderFactory()) 27 | .ConfigureContainer(builder => 28 | { 29 | builder.RegisterModule(new AutofacBusinessModule()); 30 | }) 31 | .ConfigureWebHostDefaults(webBuilder => 32 | { 33 | webBuilder.UseStartup(); 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /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:64404", 8 | "sslPort": 44352 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: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Concrete; 3 | using Core.Utilities.IoC; 4 | using Core.Utilities.Security.Encryption; 5 | using Core.Utilities.Security.JWT; 6 | using DataAccess.Abstract; 7 | using DataAccess.Concrete.EntityFramework; 8 | using Microsoft.AspNetCore.Authentication.JwtBearer; 9 | using Microsoft.AspNetCore.Builder; 10 | using Microsoft.AspNetCore.Hosting; 11 | using Microsoft.AspNetCore.Http; 12 | using Microsoft.AspNetCore.HttpsPolicy; 13 | using Microsoft.AspNetCore.Mvc; 14 | using Microsoft.Extensions.Configuration; 15 | using Microsoft.Extensions.DependencyInjection; 16 | using Microsoft.Extensions.Hosting; 17 | using Microsoft.Extensions.Logging; 18 | using Microsoft.IdentityModel.Tokens; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using System.Threading.Tasks; 23 | using Core.DependencyResolvers; 24 | using Core.Extensions; 25 | 26 | namespace WebAPI 27 | { 28 | public class Startup 29 | { 30 | public Startup(IConfiguration configuration) 31 | { 32 | Configuration = configuration; 33 | } 34 | 35 | public IConfiguration Configuration { get; } 36 | 37 | // This method gets called by the runtime. Use this method to add services to the container. 38 | public void ConfigureServices(IServiceCollection services) 39 | { 40 | services.AddControllers(); 41 | services.AddCors(); 42 | 43 | var tokenOptions = Configuration.GetSection("TokenOptions").Get(); 44 | 45 | services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) 46 | .AddJwtBearer(options => 47 | { 48 | options.TokenValidationParameters = new TokenValidationParameters 49 | { 50 | ValidateIssuer = true, 51 | ValidateAudience = true, 52 | ValidateLifetime = true, 53 | ValidIssuer = tokenOptions.Issuer, 54 | ValidAudience = tokenOptions.Audience, 55 | ValidateIssuerSigningKey = true, 56 | IssuerSigningKey = SecurityKeyHelper.CreateSecurityKey(tokenOptions.SecurityKey) 57 | }; 58 | }); 59 | services.AddDependencyResolvers(new ICoreModule[] 60 | { 61 | new CoreModule() 62 | }); 63 | 64 | } 65 | 66 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 67 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 68 | { 69 | if (env.IsDevelopment()) 70 | { 71 | app.UseDeveloperExceptionPage(); 72 | } 73 | 74 | app.UseCors(builder => builder.WithOrigins("http://localhost:4200").AllowAnyHeader().AllowAnyOrigin()); 75 | 76 | app.UseHttpsRedirection(); 77 | 78 | app.UseStaticFiles(); 79 | 80 | app.UseRouting(); 81 | 82 | app.UseStaticFiles(); 83 | 84 | app.UseAuthentication(); 85 | 86 | app.UseAuthorization(); 87 | 88 | app.UseEndpoints(endpoints => 89 | { 90 | endpoints.MapControllers(); 91 | }); 92 | } 93 | 94 | 95 | } 96 | } -------------------------------------------------------------------------------- /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": "kevser@kevser.com", 4 | "Issuer": "kevser@kevser.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/wwwroot/Images/19b9e66819154993bd29e1ebf59ebc4f.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/19b9e66819154993bd29e1ebf59ebc4f.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/21dd8e75467b480290d636eb345cb986.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/21dd8e75467b480290d636eb345cb986.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/2803ae45f76e4799924388abac31971c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/2803ae45f76e4799924388abac31971c.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/38e0c1137c7a4945afcb6e6ef770b2bf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/38e0c1137c7a4945afcb6e6ef770b2bf.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/3e1d125ff93648c6a0a7249458c8c3cd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/3e1d125ff93648c6a0a7249458c8c3cd.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/4071b2e0bd62430f9f24e349a74402c4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/4071b2e0bd62430f9f24e349a74402c4.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/4233679d946a46bc891ce350e0becc2e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/4233679d946a46bc891ce350e0becc2e.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/47d01cb1b97441269aebf2867ba5d821.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/47d01cb1b97441269aebf2867ba5d821.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/492903d7c4df43b59e958401f27e4e90.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/492903d7c4df43b59e958401f27e4e90.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/547f8262a6b04d5190ba4611fedd1bbc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/547f8262a6b04d5190ba4611fedd1bbc.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/55f3ea603865481ca05a995229160425.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/55f3ea603865481ca05a995229160425.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/601dedade69b4253b6d34cb1e5eb4c29.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/601dedade69b4253b6d34cb1e5eb4c29.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/67605d003e404f6bb3f53fcd5f8373c4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/67605d003e404f6bb3f53fcd5f8373c4.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/6c73807e7bbf463dae2ee45fe554c123.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/6c73807e7bbf463dae2ee45fe554c123.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/8161e059c1f941af8206690fbeba6393.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/8161e059c1f941af8206690fbeba6393.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/845731b561774c26b0bc4212b48aece1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/845731b561774c26b0bc4212b48aece1.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/87ef8862068549b98f833aa9a4c37e10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/87ef8862068549b98f833aa9a4c37e10.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/9120733a0501410ebf90e5c9d71c9bab.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/9120733a0501410ebf90e5c9d71c9bab.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/98a86a03d4ac48dfae0dd15f90b0f7e0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/98a86a03d4ac48dfae0dd15f90b0f7e0.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/9aff00c526bb4355882ff8fccc9b0608.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/9aff00c526bb4355882ff8fccc9b0608.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a63ab671346f4c23a1befa1a43c98e55.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/a63ab671346f4c23a1befa1a43c98e55.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a64793ab4dae4db2b7a94a29923b1005.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/a64793ab4dae4db2b7a94a29923b1005.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ab2eddf1685340349c4ebce018d635dd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/ab2eddf1685340349c4ebce018d635dd.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/af4b13490599484fb399f243e9ac6db4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/af4b13490599484fb399f243e9ac6db4.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/b67d9f79a2e24b3598d0e7921bdb7162.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/b67d9f79a2e24b3598d0e7921bdb7162.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/bd640378aaad4c09a9a2219008deac1b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/bd640378aaad4c09a9a2219008deac1b.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/c0c845866b6b4a33992b833c5a9cd911.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/c0c845866b6b4a33992b833c5a9cd911.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/c88024227dae4327ae712b7e424db717.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/c88024227dae4327ae712b7e424db717.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/c9982451a69f4fdfa88e79948c8f638d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/c9982451a69f4fdfa88e79948c8f638d.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/d21ae256027d477c8d27e29c703d8c34.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/d21ae256027d477c8d27e29c703d8c34.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/dfa9dffc00ff45179cc588aeea94c4fa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/dfa9dffc00ff45179cc588aeea94c4fa.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/e27a50f81933492f87df5da3d9b1473c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/e27a50f81933492f87df5da3d9b1473c.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/f301539c220c46b4bbbe6f280a23a90a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/f301539c220c46b4bbbe6f280a23a90a.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/f4074e7e478e48f2b8d8585fd255f045.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/f4074e7e478e48f2b8d8585fd255f045.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/f656f6d6322c4566a6658cdcd1f01022.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/f656f6d6322c4566a6658cdcd1f01022.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/fbbfb35cd59c45e6a54a235a7242d384.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/Images/fbbfb35cd59c45e6a54a235a7242d384.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/1.Hyundai i20.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/1.Hyundai i20.jfif -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/1.Peugeot 301.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/1.Peugeot 301.jfif -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/1.Skoda.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/1.Skoda.jfif -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/2.Hyundai i20.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/2.Hyundai i20.jfif -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/2.Peugeot 301.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/2.Peugeot 301.jfif -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/2.Skoda.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/2.Skoda.jfif -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/3.Hyundai i20.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/3.Hyundai i20.jfif -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/3.Skoda.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/3.Skoda.jfif -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/hyundai.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnc-kvsr/ReCapProject/dbf3e14fc45e56620ecf871987f2752460baf47d/WebAPI/wwwroot/uploads/hyundai.jfif --------------------------------------------------------------------------------