├── .gitattributes ├── .gitignore ├── Business ├── Abstract │ ├── IAuthService.cs │ ├── IBrandService.cs │ ├── ICarImageService.cs │ ├── ICarService.cs │ ├── ICardService.cs │ ├── IColorService.cs │ ├── ICustomerService.cs │ ├── IPaymentService.cs │ ├── IRentalService.cs │ └── IUserService.cs ├── Business.csproj ├── BusinessAspects │ └── Autofac │ │ └── SecuredOperation.cs ├── CCS │ ├── DatabaseLogger.cs │ ├── FileLogger.cs │ └── ILogger.cs ├── Concrete │ ├── AuthManager.cs │ ├── BrandManager.cs │ ├── CarImageManager.cs │ ├── CarManager.cs │ ├── CardManager.cs │ ├── ColorManager.cs │ ├── CustomerManager.cs │ ├── PaymentManager.cs │ ├── RentalManager.cs │ └── UserManager.cs ├── Constants │ └── Messages.cs ├── DependencyResolvers │ └── Autofac │ │ └── AutofacBusinessModule.cs └── ValidationRules │ └── FluentValidation │ ├── BrandValidator.cs │ ├── CarImageValidator.cs │ ├── CarValidator.cs │ ├── ColorValidator.cs │ ├── CustomerValidator.cs │ ├── RentalValidator.cs │ └── UserValidator.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 │ ├── ErrorDetails.cs │ ├── ExceptionMiddleware.cs │ ├── ExceptionMiddlewareExtensions.cs │ ├── ServiceCollectionExtensions.cs │ └── ValidationErrorDetails.cs └── Utilities │ ├── Business │ └── BusinessRules.cs │ ├── Helpers │ └── FileHelper.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 ├── DataAccess ├── Abstract │ ├── IBrandDal.cs │ ├── ICarDal.cs │ ├── ICarImageDal.cs │ ├── ICardDal.cs │ ├── IColorDal.cs │ ├── ICustomerDal.cs │ ├── IPaymentDal.cs │ ├── IRentalDal.cs │ └── IUserDal.cs ├── Concrete │ ├── EntityFramework │ │ ├── EfBrandDal.cs │ │ ├── EfCarDal.cs │ │ ├── EfCarImageDal.cs │ │ ├── EfCardDal.cs │ │ ├── EfColorDal.cs │ │ ├── EfCustomerDal.cs │ │ ├── EfPaymentDal.cs │ │ ├── EfRentalDal.cs │ │ ├── EfUserDal.cs │ │ └── RentACarDbContext.cs │ └── InMemory │ │ └── InMemoryCarDal.cs └── DataAccess.csproj ├── Entities ├── Concrete │ ├── Brand.cs │ ├── Car.cs │ ├── CarImage.cs │ ├── Card.cs │ ├── Color.cs │ ├── Customer.cs │ ├── Payment.cs │ └── Rental.cs ├── DTOs │ ├── CarDetailDto.cs │ ├── ChangePasswordDto.cs │ ├── CustomerDetailDto.cs │ ├── RentalDetailDto.cs │ ├── UserForLoginDto.cs │ └── UserForRegisterDto.cs └── Entities.csproj ├── README.md ├── README_TR.md ├── ReCapProject.sln └── WebAPI ├── Controllers ├── AuthController.cs ├── BrandsController.cs ├── CarImagesController.cs ├── CardsController.cs ├── CarsController.cs ├── ColorsController.cs ├── CustomersController.cs ├── FileUploadController.cs ├── PaymentsController.cs ├── RentalsController.cs ├── UsersController.cs └── WeatherForecastController.cs ├── Images ├── 06a9b754-1afe-4d08-9994-598bfdd7c37a_3_16_2021.jpg ├── 419c3e65-bbb2-43a1-b91a-eff414522285_3_16_2021.jpg ├── 469f5114-c14a-4251-9f80-030175d983d4_3_16_2021.jpg ├── 566cbc49-6813-497e-93c4-e6ea0fc7960b_2_28_2021.jpg ├── 586e6696-a2ed-4844-a101-799fd914f872_2_27_2021.jpg ├── 77d2249f-9084-45e3-8c56-b964c02b2faf_2_27_2021.jpg ├── 7ea9f24e-64d7-4798-854c-8b4cb6af044f_2_27_2021.jpg ├── 8042a53c-d366-4449-850e-c50169dce812_3_16_2021.jpg ├── 985ae33e-78e6-4826-8aeb-7ca2cf94a8c5_2_28_2021.jpg ├── 9d43881e-731d-41e0-b493-1cc736ac8ff4_2_27_2021.jpg └── defaultimage.jpg ├── Models └── FileUpload.cs ├── Program.cs ├── Properties └── launchSettings.json ├── Startup.cs ├── WeatherForecast.cs ├── WebAPI.csproj ├── appsettings.Development.json ├── appsettings.json └── wwwroot ├── Images ├── 2b1a667a-7df4-4fc3-b47c-58d87b859de5_3_16_2021.jpg ├── 2c380fa9-de9a-49ae-a7a2-b1f41424a5a1_3_16_2021.jpg ├── 356f0aef-76f0-4046-ae9e-4f4a96b8f5b4_3_16_2021.jpg ├── 4bccf739-c461-45dc-b13f-f2e323a01a12_3_16_2021.jpg ├── 55d11189-0299-49ee-8e4a-f67a49a26693_3_16_2021.jpg ├── 62e16810-9eb2-476b-afc5-3339bfd68fab_3_16_2021.jpg ├── 6cc7e970-a408-4f67-9bae-14d4754b51e4_3_16_2021.jpg ├── 76643d65-3c36-4c12-ba64-d9a9f6ccd051.jpg ├── 92e6aa07-63e3-4093-b0d2-b89b644cb0ef_3_16_2021.jpg ├── 97e8ebbc-a444-4ae5-9726-c234e48795bb_3_16_2021.jpg ├── 9b87999d-e638-4a34-b72d-969e41b1765d_3_16_2021.jpg ├── a7d5512c-6b50-466f-9674-e6568a3816d6_3_16_2021.jpg ├── ad57642a-e566-43ac-9215-10c4908d0d75_3_16_2021.jpg ├── b3056f03-a41f-4eeb-988f-052c43a907fa_3_16_2021.jpg ├── c4cb7f7f-5e49-48b6-a59f-4aa873b2e660_3_16_2021.jpg ├── default.jpg ├── e0e763e2-6013-44d2-b729-9b652a8b41f7_3_16_2021.jpg ├── e98e65f1-607e-462d-a179-6566616215ea.jpg ├── f9466911-d9fa-4a77-ae74-3f34b07a90bc_3_16_2021.jpg ├── fa9ebd06-d4d1-473b-9c2b-bb07c2e8d4e4_3_16_2021.jpg ├── fc7a0464-8f54-4ad2-8770-29cc5c0216b8_3_16_2021.jpg └── ffe3e3ee-fcdd-40bf-a49d-629101e8749e_3_16_2021.jpg └── uploads └── 50c518ca1f394960aa522f121cf908b5_2021_2_26.jpg /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /Business/Abstract/IAuthService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using Core.Utilities.Security.JWT; 4 | using Entities.DTOs; 5 | 6 | namespace Business.Abstract 7 | { 8 | public interface IAuthService 9 | { 10 | IDataResult Register(UserForRegisterDto userForRegisterDto, string password); 11 | IDataResult Login(UserForLoginDto userForLoginDto); 12 | IResult UserExists(string email); 13 | IDataResult CreateAccessToken(User user); 14 | IResult ChangePassword(ChangePasswordDto changePasswordDto); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /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 GetById(int brandId); 13 | IResult Add(Brand brand); 14 | IResult Update(Brand brand); 15 | IResult Delete(Brand brand); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Business/Abstract/ICarImageService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using 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 | IResult Add(CarImage carImage,IFormFile file); 13 | IResult Delete(CarImage carImage); 14 | IResult Update(CarImage carImage, IFormFile file); 15 | IDataResult Get(int id); 16 | IDataResult> GetAll(); 17 | IDataResult> GetImagesByCarId(int id); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Business/Abstract/ICarService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace Business.Abstract 10 | { 11 | public interface ICarService 12 | { 13 | IDataResult Add(Car car); 14 | IResult Update(Car car); 15 | IResult Delete(Car car); 16 | IDataResult> GetAll(); 17 | IDataResult GetById(int carId); 18 | IDataResult> GetCarsByColorId(int colorId); 19 | IDataResult> GetCarsByBrandId(int brandId); 20 | IDataResult> GetByDailyPrice(decimal min, decimal max); 21 | IDataResult> GetByModelYear(string modelYear); 22 | IDataResult> GetCarDetails(Expression> filter = null); 23 | 24 | IResult AddTransactionalTest(Car car); 25 | IDataResult> GetCarsBySelect(int brandId, int colorId); 26 | IDataResult> GetCarDetail(int carId); 27 | 28 | IDataResult GetCarFindex(int carId); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Business/Abstract/ICardService.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 ICardService 10 | { 11 | IResult AddCard(Card card); 12 | IDataResult> GetCardsByUserId(int userId); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /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 GetById(int colorId); 13 | IResult Add(Color color); 14 | IResult Update(Color color); 15 | IResult Delete(Color color); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Business/Abstract/ICustomerService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace Business.Abstract 10 | { 11 | public interface ICustomerService 12 | { 13 | IResult Add(Customer customer); 14 | IResult Update(Customer customer); 15 | IResult Delete(Customer customer); 16 | IDataResult GetById(int customerId); 17 | IDataResult> GetAll(); 18 | 19 | IDataResult> GetCustomerDetails(Expression> filter = null); 20 | IDataResult GetByUserId(int userId); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Business/Abstract/IPaymentService.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 IPaymentService 10 | { 11 | IResult Add(Payment payment); 12 | IResult CheckPayment(Payment payment); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /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.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace Business.Abstract 10 | { 11 | public interface IRentalService 12 | { 13 | IResult Add(Rental rental); 14 | IResult Update(Rental rental); 15 | IResult Delete(Rental rental); 16 | IDataResult GetById(int rentalId); 17 | IDataResult> GetAll(); 18 | IDataResult> GetRentalByCustomerId(int customerId); 19 | IDataResult> GetRentalByCarId(int carId); 20 | IDataResult> GetRentalByRentDate(DateTime rentDate); 21 | IDataResult> GetRentalByReturnDate(DateTime returnDate); 22 | IDataResult> GetRentalDetails(Expression> filter = null); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Business/Abstract/IUserService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Business.Abstract 8 | { 9 | public interface IUserService 10 | { 11 | IResult Add(User user); 12 | IResult Update(User user); 13 | IResult Delete(User user); 14 | IDataResult GetById(int userId); 15 | IDataResult> GetAll(); 16 | 17 | IDataResult> GetClaims(User user); 18 | IDataResult GetByMail(string email); 19 | IDataResult GetUserFindexByUserId(int userId); 20 | IResult UpdateUserFindex(int userId); 21 | IResult UpdateInfo(User user); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Business/Business.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Business/BusinessAspects/Autofac/SecuredOperation.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Interceptors; 2 | using Core.Utilities.IoC; 3 | using Microsoft.AspNetCore.Http; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using Castle.DynamicProxy; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Core.Extensions; 10 | using Business.Constants; 11 | 12 | namespace Business.BusinessAspects.Autofac 13 | { 14 | //JWT 15 | public class SecuredOperation : MethodInterception 16 | { 17 | private string[] _roles; 18 | private IHttpContextAccessor _httpContextAccessor; 19 | 20 | public SecuredOperation(string roles) 21 | { 22 | _roles = roles.Split(','); 23 | _httpContextAccessor = ServiceTool.ServiceProvider.GetService(); 24 | 25 | } 26 | 27 | protected override void OnBefore(IInvocation invocation) 28 | { 29 | var roleClaims = _httpContextAccessor.HttpContext.User.ClaimRoles(); 30 | foreach (var role in _roles) 31 | { 32 | if (roleClaims.Contains(role)) 33 | { 34 | return; 35 | } 36 | } 37 | throw new Exception(Messages.AuthorizationDenied); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Business/CCS/DatabaseLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Business.CCS 4 | { 5 | public class DatabaseLogger : ILogger 6 | { 7 | public void Log() 8 | { 9 | Console.WriteLine("Log Added to Database"); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Business/CCS/FileLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Business.CCS 6 | { 7 | public class FileLogger : ILogger 8 | { 9 | public void Log() 10 | { 11 | Console.WriteLine("Log Added to File"); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Business/CCS/ILogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Business.CCS 6 | { 7 | public interface ILogger 8 | { 9 | void Log(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /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.Data.PasswordHash, userToCheck.Data.PasswordSalt)) 48 | { 49 | return new ErrorDataResult(Messages.PasswordError); 50 | } 51 | 52 | return new SuccessDataResult(userToCheck.Data, Messages.SuccessfulLogin); 53 | } 54 | 55 | public IResult UserExists(string email) 56 | { 57 | if (_userService.GetByMail(email).Data != 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.Data); 68 | return new SuccessDataResult(accessToken, Messages.AccessTokenCreated); 69 | } 70 | 71 | public IResult ChangePassword(ChangePasswordDto changePasswordDto) 72 | { 73 | byte[] passwordHash, passwordSalt; 74 | var userToCheck = _userService.GetById(changePasswordDto.UserId).Data; 75 | if (userToCheck == null) 76 | { 77 | return new ErrorResult(Messages.UserNotFound); 78 | } 79 | if (!HashingHelper.VerifyPasswordHash(changePasswordDto.OldPassword, userToCheck.PasswordHash, userToCheck.PasswordSalt)) 80 | { 81 | return new ErrorResult(Messages.PasswordError); 82 | } 83 | HashingHelper.CreatePasswordHash(changePasswordDto.NewPassword, out passwordHash, out passwordSalt); 84 | userToCheck.PasswordHash = passwordHash; 85 | userToCheck.PasswordSalt = passwordSalt; 86 | _userService.Update(userToCheck); 87 | return new SuccessResult(Messages.PasswordChanged); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Business/Concrete/BrandManager.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.Performance; 7 | using Core.Aspects.Autofac.Validation; 8 | using Core.Utilities.Results; 9 | using DataAccess.Abstract; 10 | using Entities.Concrete; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | 15 | namespace Business.Concrete 16 | { 17 | public class BrandManager : IBrandService 18 | { 19 | IBrandDal _brandDal; 20 | 21 | public BrandManager(IBrandDal brandDal) 22 | { 23 | _brandDal = brandDal; 24 | } 25 | 26 | [SecuredOperation("product.add,admin")] 27 | [ValidationAspect(typeof(BrandValidator))] 28 | [CacheRemoveAspect("IBrandService.Get")] 29 | public IResult Add(Brand brand) 30 | { 31 | _brandDal.Add(brand); 32 | return new SuccessResult(Messages.BrandAdded); 33 | } 34 | 35 | [SecuredOperation("product.add,admin")] 36 | [ValidationAspect(typeof(BrandValidator))] 37 | [CacheRemoveAspect("IBrandService.Get")] 38 | public IResult Update(Brand brand) 39 | { 40 | _brandDal.Update(brand); 41 | return new SuccessResult(Messages.BrandUpdated); 42 | } 43 | 44 | [SecuredOperation("product.add,admin")] 45 | [ValidationAspect(typeof(BrandValidator))] 46 | [CacheRemoveAspect("IBrandService.Get")] 47 | public IResult Delete(Brand brand) 48 | { 49 | _brandDal.Delete(brand); 50 | return new SuccessResult(Messages.BrandDeleted); 51 | } 52 | 53 | [CacheAspect] 54 | public IDataResult> GetAll() 55 | { 56 | return new SuccessDataResult>(_brandDal.GetAll()); 57 | } 58 | 59 | [CacheAspect] 60 | public IDataResult GetById(int brandId) 61 | { 62 | return new SuccessDataResult(_brandDal.Get(b => b.BrandId == brandId)); 63 | } 64 | 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Business/Concrete/CarImageManager.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.Utilities.Business; 8 | using Core.Utilities.Helpers; 9 | using Core.Utilities.Results; 10 | using DataAccess.Abstract; 11 | using Entities.Concrete; 12 | using Microsoft.AspNetCore.Http; 13 | using System; 14 | using System.Collections.Generic; 15 | using System.IO; 16 | using System.Linq; 17 | using System.Text; 18 | 19 | namespace Business.Concrete 20 | { 21 | public class CarImageManager : ICarImageService 22 | { 23 | ICarImageDal _carImageDal; 24 | 25 | public CarImageManager(ICarImageDal carImageDAL) 26 | { 27 | _carImageDal = carImageDAL; 28 | } 29 | 30 | [SecuredOperation("carimage.add,admin")] 31 | [ValidationAspect(typeof(CarImageValidator))] 32 | [CacheRemoveAspect("ICarImageService.Get")] 33 | public IResult Add(CarImage carImage, IFormFile file) 34 | { 35 | IResult result = BusinessRules.Run(CheckImageLimitExceeded(carImage.CarId), CheckIfImageExtensionValid(file)); 36 | if (result != null) 37 | { 38 | return result; 39 | } 40 | carImage.ImagePath = FileHelper.Add(file); 41 | carImage.ImageDate = DateTime.Now; 42 | _carImageDal.Add(carImage); 43 | return new SuccessResult(Messages.CarImageAdded); 44 | } 45 | 46 | [SecuredOperation("carimage.delete,admin")] 47 | [ValidationAspect(typeof(CarImageValidator))] 48 | [CacheRemoveAspect("ICarImageService.Get")] 49 | public IResult Delete(CarImage carImage) 50 | { 51 | string path = Get(carImage.CarImageId).Data.ImagePath; 52 | IResult result = BusinessRules.Run(CheckIfImageExists(carImage.CarImageId), CheckIfImageCanDelete(path)); 53 | if (result != null) 54 | { 55 | return result; 56 | } 57 | FileHelper.Delete(carImage.ImagePath); 58 | _carImageDal.Delete(carImage); 59 | return new SuccessResult(Messages.CarImageDeleted); 60 | } 61 | 62 | [SecuredOperation("carimage.update,admin")] 63 | [ValidationAspect(typeof(CarImageValidator))] 64 | [CacheRemoveAspect("ICarImageService.Get")] 65 | //public IResult Update(IFormFile file, CarImage carImage) 66 | //{ 67 | // IResult result = BusinessRules.Run(CheckImageLimitExceeded(carImage.CarId), CheckIfImageExtensionValid(file), CheckIfImageExists(carImage.Id)); 68 | // if (result != null) 69 | // { 70 | // return result; 71 | // } 72 | // carImage.ImageDate = DateTime.Now; 73 | // string oldPath = Get(carImage.CarImageId).Data.ImagePath; 74 | // carImage.ImagePath = FileHelper.Update(file, oldPath); 75 | // _carImageDal.Update(carImage); 76 | // return new SuccessResult(Messages.CarImageUpdated); 77 | //} 78 | public IResult Update(CarImage carImage, IFormFile file) 79 | { 80 | IResult result = BusinessRules.Run(CheckImageLimitExceeded(carImage.CarId), CheckIfImageExtensionValid(file), CheckIfImageExists(carImage.CarImageId)); 81 | if (result != null) 82 | { 83 | return result; 84 | } 85 | carImage.ImageDate = DateTime.Now; 86 | string oldPath = Get(carImage.CarImageId).Data.ImagePath; 87 | carImage.ImagePath = FileHelper.Update(file, oldPath); 88 | _carImageDal.Update(carImage); 89 | return new SuccessResult(Messages.CarImageUpdated); 90 | } 91 | 92 | 93 | 94 | [ValidationAspect(typeof(CarImageValidator))] 95 | public IDataResult Get(int id) 96 | { 97 | return new SuccessDataResult(_carImageDal.Get(p => p.CarImageId == id)); 98 | } 99 | public IDataResult> GetAll() 100 | { 101 | return new SuccessDataResult>(_carImageDal.GetAll()); 102 | } 103 | 104 | [ValidationAspect(typeof(CarImageValidator))] 105 | public IDataResult> GetImagesByCarId(int id) 106 | { 107 | IResult result = BusinessRules.Run(CheckIfCarImageNull(id)); 108 | if (result != null) 109 | { 110 | return new ErrorDataResult>(result.Message); 111 | } 112 | return new SuccessDataResult>(CheckIfCarImageNull(id).Data); 113 | } 114 | 115 | //business rules 116 | private IResult CheckImageLimitExceeded(int carid) 117 | { 118 | var carImagecount = _carImageDal.GetAll(p => p.CarId == carid).Count; 119 | if (carImagecount >= 5) 120 | { 121 | return new ErrorResult(Messages.CarImageCountOfCarIdError); 122 | } 123 | 124 | return new SuccessResult(); 125 | } 126 | private IDataResult> CheckIfCarImageNull(int carId) 127 | { 128 | string path = "default.jpg"; 129 | var result = _carImageDal.GetAll(c => c.CarId == carId).Any(); 130 | if (!result) 131 | { 132 | List carimage = new List(); 133 | carimage.Add(new CarImage 134 | { 135 | CarId = carId, 136 | ImageDate = DateTime.Now, 137 | ImagePath = path 138 | }); 139 | return new SuccessDataResult>(carimage); 140 | } 141 | return new SuccessDataResult>(_carImageDal.GetAll(c => c.CarId == carId).ToList()); 142 | } 143 | 144 | 145 | private IResult CheckIfImageExists(int id) 146 | { 147 | if (_carImageDal.IsExists(id)) 148 | { 149 | return new SuccessResult(); 150 | } 151 | return new ErrorResult(Messages.CarImageMustBeExists); 152 | } 153 | 154 | private IResult CheckIfImageCanDelete(string path) 155 | { 156 | if (File.Exists(path) && Path.GetFileName(path) != @"\WebAPI\wwwroot\Images\default1.jpg") 157 | { 158 | return new SuccessResult(); 159 | } 160 | return new ErrorResult(Messages.FileCannotDelete); 161 | } 162 | 163 | private IResult CheckIfImageExtensionValid(IFormFile file) 164 | { 165 | bool IsValidFileExtension = Messages.ValidImageFileTypes.Any(t => t == Path.GetExtension(file.FileName).ToUpper()); 166 | if (!IsValidFileExtension) 167 | { 168 | return new ErrorResult(Messages.InvalidImageExtension); 169 | } 170 | return new SuccessResult(); 171 | } 172 | 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /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.Performance; 7 | using Core.Aspects.Autofac.Transaction; 8 | using Core.Aspects.Autofac.Validation; 9 | using Core.CrossCuttingConcerns.Validation; 10 | using Core.Utilities.Results; 11 | using DataAccess.Abstract; 12 | using DataAccess.Concrete.EntityFramework; 13 | using Entities.Concrete; 14 | using Entities.DTOs; 15 | using FluentValidation; 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq.Expressions; 19 | using System.Text; 20 | using System.Threading; 21 | 22 | namespace Business.Concrete 23 | { 24 | public class CarManager : ICarService 25 | { 26 | ICarDal _carDal; 27 | 28 | public CarManager(ICarDal carDal) 29 | { 30 | _carDal = carDal; 31 | } 32 | 33 | [SecuredOperation("car.add,admin")] 34 | [ValidationAspect(typeof(CarValidator))] 35 | [CacheRemoveAspect("ICarService.Get")] 36 | public IDataResult Add(Car car) 37 | { 38 | //TryAgain: 39 | //if (car.DailyPrice>0 && car.CarName.Length>2) //Both turns true 40 | //{ 41 | // _carDal.Add(car); 42 | // Console.WriteLine("Car Id: " +car.CarId + " Added with "+car.DailyPrice+" Daily Price Successfully"); 43 | //} 44 | //else if(car.DailyPrice <= 0 && car.CarName.Length > 2) //carname turns true - dailyprice turn false 45 | //{ 46 | // Console.WriteLine("Error!!! Daily Price must be higher than 0"); 47 | // Console.WriteLine("Please write a correct value for daily price"); 48 | // car.DailyPrice= Convert.ToInt32(Console.ReadLine()); 49 | // goto TryAgain; 50 | //} 51 | //else if(car.DailyPrice > 0 && car.CarName.Length <= 2) //carname turns false - dailyprice turn true 52 | //{ 53 | // Console.WriteLine("Error!!! Car name must be longer than 2 letters"); 54 | // Console.WriteLine("Please write a correct car name"); 55 | // car.CarName = Console.ReadLine(); 56 | // goto TryAgain; 57 | //} 58 | //else 59 | //{ 60 | // Console.WriteLine("Error!!! Car name and Daily Price wrong"); 61 | //} 62 | 63 | //VERSION 2.0 64 | 65 | //while (car.DailyPrice <= 0 && car.CarName.Length <= 2) 66 | //{ 67 | // Console.WriteLine("Error!!! Daily Price must be higher than 0 and Car name must be longer than 2 letters"); 68 | // Console.WriteLine("Please write a correct value for daily price"); 69 | // car.DailyPrice = Convert.ToInt32(Console.ReadLine()); 70 | // Console.WriteLine("Please write a correct value for car name"); 71 | // car.CarName = Console.ReadLine(); 72 | //} 73 | //if (car.CarName.Length<2) 74 | //{ 75 | // return new ErrorResult(Messages.CarNameInvalid); 76 | //} 77 | 78 | _carDal.Add(car); 79 | return new SuccessDataResult(car,Messages.CarAdded); 80 | //Console.WriteLine("Car Name: " + car.CarName + " Added with " + car.DailyPrice + " Daily Price Successfully"); 81 | 82 | 83 | } 84 | [SecuredOperation("car.update,admin")] 85 | [ValidationAspect(typeof(CarValidator))] 86 | [CacheRemoveAspect("ICarService.Get")] 87 | public IResult Update(Car car) 88 | { 89 | 90 | _carDal.Update(car); 91 | //Console.WriteLine("Updated Successfully"); 92 | return new SuccessResult(Messages.CarUpdated); 93 | } 94 | 95 | [SecuredOperation("car.delete,admin")] 96 | [CacheRemoveAspect("ICarService.Get")] 97 | public IResult Delete(Car car) 98 | { 99 | _carDal.Delete(car); 100 | //Console.WriteLine("Deleted Successfully"); 101 | return new SuccessResult(Messages.CarDeleted); 102 | } 103 | 104 | [CacheAspect] 105 | public IDataResult> GetAll() 106 | { 107 | //if (DateTime.Now.Hour==23) 108 | //{ 109 | // return new ErrorDataResult>(Messages.MaintenanceTime); 110 | //} 111 | 112 | return new SuccessDataResult>(_carDal.GetAll(), Messages.CarsListed); 113 | 114 | } 115 | 116 | [CacheAspect] 117 | //[PerformanceAspect(2)] 118 | public IDataResult GetById(int carId) 119 | { 120 | //Thread.Sleep(5000); 121 | return new SuccessDataResult(_carDal.Get(c => c.CarId == carId)); 122 | } 123 | 124 | [CacheAspect] 125 | public IDataResult> GetCarsByBrandId(int brandId) 126 | { 127 | //Console.WriteLine("Car Id Brand Name Color Name Model Year Daily Price Description"); 128 | return new SuccessDataResult>(_carDal.GetCarDetails(b => b.BrandId == brandId)); 129 | } 130 | 131 | public IDataResult> GetCarsByColorId(int colorId) 132 | { 133 | //Console.WriteLine("Car Id Brand Name Color Name Model Year Daily Price Description"); 134 | return new SuccessDataResult>(_carDal.GetCarDetails(co => co.ColorId == colorId)); 135 | } 136 | public IDataResult> GetByModelYear(string modelYear) 137 | { 138 | return new SuccessDataResult>(_carDal.GetCarDetails(c => c.ModelYear == modelYear)); 139 | } 140 | 141 | public IDataResult> GetByDailyPrice(decimal min, decimal max) 142 | { 143 | return new SuccessDataResult>(_carDal.GetCarDetails(c => c.DailyPrice >= min && c.DailyPrice <= max)); 144 | } 145 | 146 | public IDataResult> GetCarDetails(Expression> filter = null) 147 | { 148 | //if (DateTime.Now.Hour == 13) 149 | //{ 150 | // return new ErrorDataResult>(Messages.MaintenanceTime); 151 | //} 152 | return new SuccessDataResult>(_carDal.GetCarDetails(filter)); 153 | } 154 | 155 | [TransactionScopeAspect] 156 | public IResult AddTransactionalTest(Car car) 157 | { 158 | 159 | Add(car); 160 | if (car.CarName.Length<2) 161 | { 162 | throw new Exception(""); 163 | } 164 | Add(car); 165 | return null; 166 | } 167 | 168 | public IDataResult> GetCarsBySelect(int brandId, int colorId) 169 | { 170 | return new SuccessDataResult>(_carDal.GetCarDetails(c => c.ColorId == colorId & c.BrandId==brandId)); 171 | } 172 | 173 | public IDataResult> GetCarDetail(int carId) 174 | { 175 | return new SuccessDataResult>(_carDal.GetCarDetails(c => c.CarId == carId)); 176 | } 177 | public IDataResult GetCarFindex(int carId) 178 | { 179 | return new SuccessDataResult(_carDal.Get(c => c.CarId == carId)); 180 | } 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /Business/Concrete/CardManager.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 CardManager : ICardService 13 | { 14 | ICardDal _cardDal; 15 | 16 | public CardManager(ICardDal cardDal) 17 | { 18 | _cardDal = cardDal; 19 | } 20 | 21 | public IResult AddCard(Card card) 22 | { 23 | _cardDal.Add(card); 24 | return new SuccessResult(Messages.CardAdded); 25 | } 26 | 27 | public IDataResult> GetCardsByUserId(int userId) 28 | { 29 | return new SuccessDataResult>(_cardDal.GetAll(c => c.UserId == userId)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Business/Concrete/ColorManager.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.Performance; 7 | using Core.Aspects.Autofac.Validation; 8 | using Core.Utilities.Results; 9 | using DataAccess.Abstract; 10 | using Entities.Concrete; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | 15 | namespace Business.Concrete 16 | { 17 | public class ColorManager : IColorService 18 | { 19 | IColorDal _colorDal; 20 | 21 | public ColorManager(IColorDal colorDal) 22 | { 23 | _colorDal = colorDal; 24 | } 25 | [SecuredOperation("color.add,admin")] 26 | [ValidationAspect(typeof(ColorValidator))] 27 | [CacheRemoveAspect("IColorService.Get")] 28 | public IResult Add(Color color) 29 | { 30 | _colorDal.Add(color); 31 | return new SuccessResult(Messages.ColorAdded); 32 | } 33 | 34 | [SecuredOperation("color.update,admin")] 35 | [ValidationAspect(typeof(ColorValidator))] 36 | [CacheRemoveAspect("IColorService.Get")] 37 | public IResult Update(Color color) 38 | { 39 | _colorDal.Update(color); 40 | return new SuccessResult(Messages.ColorUpdated); 41 | } 42 | 43 | [SecuredOperation("color.delete,admin")] 44 | [ValidationAspect(typeof(ColorValidator))] 45 | [CacheRemoveAspect("IColorService.Get")] 46 | public IResult Delete(Color color) 47 | { 48 | _colorDal.Delete(color); 49 | return new SuccessResult(Messages.ColorDeleted); 50 | } 51 | 52 | public IDataResult> GetAll() 53 | { 54 | return new SuccessDataResult>(_colorDal.GetAll()); 55 | } 56 | 57 | [CacheAspect] 58 | [PerformanceAspect(5)] 59 | public IDataResult GetById(int colorId) 60 | { 61 | return new SuccessDataResult(_colorDal.Get(co => co.ColorId == colorId)); 62 | } 63 | 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Business/Concrete/CustomerManager.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.Performance; 7 | using Core.Aspects.Autofac.Validation; 8 | using Core.Utilities.Results; 9 | using DataAccess.Abstract; 10 | using Entities.Concrete; 11 | using Entities.DTOs; 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Linq.Expressions; 15 | using System.Text; 16 | 17 | namespace Business.Concrete 18 | { 19 | public class CustomerManager : ICustomerService 20 | { 21 | ICustomerDal _customerDal; 22 | 23 | 24 | public CustomerManager(ICustomerDal customerDal) 25 | { 26 | _customerDal = customerDal; 27 | } 28 | 29 | [SecuredOperation("customer.add,admin")] 30 | [ValidationAspect(typeof(CustomerValidator))] 31 | public IResult Add(Customer customer) 32 | { 33 | _customerDal.Add(customer); 34 | return new SuccessResult(Messages.CustomerAdded); 35 | } 36 | 37 | [SecuredOperation("customer.update,admin")] 38 | [ValidationAspect(typeof(CustomerValidator))] 39 | public IResult Update(Customer customer) 40 | { 41 | _customerDal.Add(customer); 42 | return new SuccessResult(Messages.CustomerUpdated); 43 | } 44 | 45 | [SecuredOperation("customer.delete,admin")] 46 | [ValidationAspect(typeof(CustomerValidator))] 47 | public IResult Delete(Customer customer) 48 | { 49 | _customerDal.Add(customer); 50 | return new SuccessResult(Messages.CustomerDeleted); 51 | } 52 | 53 | [CacheAspect] 54 | public IDataResult> GetAll() 55 | { 56 | return new SuccessDataResult>(_customerDal.GetAll()); 57 | } 58 | 59 | [CacheAspect] 60 | public IDataResult GetById(int customerId) 61 | { 62 | return new SuccessDataResult(_customerDal.Get(cu => cu.CustomerId == customerId)); 63 | } 64 | 65 | public IDataResult> GetCustomerDetails(Expression> filter = null) 66 | { 67 | return new SuccessDataResult>(_customerDal.GetCustomerDetails(filter), Messages.CustomersListed); 68 | } 69 | public IDataResult GetByUserId(int userId) 70 | { 71 | return new SuccessDataResult(_customerDal.Get(c => c.UserId == userId)); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Business/Concrete/PaymentManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Core.Utilities.Results; 4 | using DataAccess.Abstract; 5 | using Entities.Concrete; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | 11 | namespace Business.Concrete 12 | { 13 | public class PaymentManager : IPaymentService 14 | { 15 | IPaymentDal _paymentDal; 16 | 17 | public PaymentManager(IPaymentDal paymentDal) 18 | { 19 | _paymentDal = paymentDal; 20 | } 21 | 22 | public IResult Add(Payment payment) 23 | { 24 | _paymentDal.Add(payment); 25 | return new SuccessResult(Messages.SuccessfullyPaid); 26 | } 27 | 28 | public IResult CheckPayment(Payment payment) 29 | { 30 | var paymentToCheck = _paymentDal.GetAll(p => p.CardNumber == payment.CardNumber && 31 | p.CVV == payment.CVV && 32 | p.ExpirationDate == payment.ExpirationDate).Any(); 33 | if (paymentToCheck) 34 | { 35 | return new SuccessResult(Messages.PaymentSucceeded); 36 | } 37 | else 38 | { 39 | return new ErrorResult(Messages.PaymentError); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Business/Concrete/RentalManager.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.Performance; 7 | using Core.Aspects.Autofac.Validation; 8 | using Core.Utilities.Results; 9 | using DataAccess.Abstract; 10 | using Entities.Concrete; 11 | using Entities.DTOs; 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Linq; 15 | using System.Linq.Expressions; 16 | using System.Text; 17 | 18 | namespace Business.Concrete 19 | { 20 | public class RentalManager : IRentalService 21 | { 22 | IRentalDal _rentalDal; 23 | 24 | public RentalManager(IRentalDal rentalDal) 25 | { 26 | _rentalDal = rentalDal; 27 | } 28 | 29 | [SecuredOperation("rental.add,admin")] 30 | [ValidationAspect(typeof(RentalValidator))] 31 | [CacheRemoveAspect("IRentalService.Get")] 32 | public IResult Add(Rental rental) 33 | { 34 | var result = _rentalDal.GetRentalDetails(r1 => r1.CarId == rental.CarId && (r1.ReturnDate == null || r1.ReturnDate>rental.RentDate)); 35 | if (result.Count > 0) 36 | { 37 | return new ErrorResult(Messages.RentalInvalid); 38 | } 39 | _rentalDal.Add(rental); 40 | return new SuccessResult(Messages.RentalAdded); 41 | } 42 | 43 | [SecuredOperation("rental.update,admin")] 44 | [ValidationAspect(typeof(RentalValidator))] 45 | [CacheRemoveAspect("IRentalService.Get")] 46 | public IResult Update(Rental rental) 47 | { 48 | //var result = _rentalDal.GetAll(x => x.CarId == rental.CarId); 49 | //var updatedRental = result.LastOrDefault(); 50 | //if (updatedRental.ReturnDate != null) 51 | //{ 52 | // return new ErrorResult(); 53 | //} 54 | //updatedRental.ReturnDate = DateTime.Now; 55 | //_rentalDal.Update(updatedRental); 56 | _rentalDal.Update(rental); 57 | return new SuccessResult(Messages.RentalUpdated); 58 | } 59 | 60 | [SecuredOperation("rental.delete,admin")] 61 | [CacheRemoveAspect("IRentalService.Get")] 62 | public IResult Delete(Rental rental) 63 | { 64 | _rentalDal.Delete(rental); 65 | return new SuccessResult(Messages.RentalDeleted); 66 | } 67 | 68 | public IDataResult> GetAll() 69 | { 70 | return new SuccessDataResult>(_rentalDal.GetAll(), Messages.RentalsListed); 71 | } 72 | 73 | [CacheAspect] 74 | [PerformanceAspect(5)] 75 | public IDataResult GetById(int rentalId) 76 | { 77 | return new SuccessDataResult(_rentalDal.Get(r => r.RentalId == rentalId)); 78 | 79 | } 80 | 81 | public IDataResult> GetRentalByCarId(int carId) 82 | { 83 | return new SuccessDataResult>(_rentalDal.GetRentalDetails(c => c.CarId == carId)); 84 | } 85 | 86 | public IDataResult> GetRentalByCustomerId(int customerId) 87 | { 88 | return new SuccessDataResult>(_rentalDal.GetRentalDetails(cu => cu.CustomerId == customerId)); 89 | } 90 | 91 | public IDataResult> GetRentalByRentDate(DateTime rentDate) 92 | { 93 | return new SuccessDataResult>(_rentalDal.GetRentalDetails(r => r.RentDate == rentDate)); 94 | } 95 | 96 | public IDataResult> GetRentalByReturnDate(DateTime returnDate) 97 | { 98 | return new SuccessDataResult>(_rentalDal.GetRentalDetails(r => r.ReturnDate == returnDate)); 99 | } 100 | 101 | public IDataResult> GetRentalDetails(Expression> filter = null) 102 | { 103 | return new SuccessDataResult>(_rentalDal.GetRentalDetails(filter), Messages.RentalReturned); 104 | } 105 | 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Business/Concrete/UserManager.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.Performance; 7 | using Core.Aspects.Autofac.Validation; 8 | using Core.Entities.Concrete; 9 | using Core.Utilities.Results; 10 | using DataAccess.Abstract; 11 | 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Text; 15 | 16 | namespace Business.Concrete 17 | { 18 | public class UserManager : IUserService 19 | { 20 | IUserDal _userDal; 21 | 22 | public UserManager(IUserDal userDal) 23 | { 24 | _userDal = userDal; 25 | } 26 | [SecuredOperation("user.add,admin")] 27 | [ValidationAspect(typeof(UserValidator))] 28 | public IResult Add(User user) 29 | { 30 | _userDal.Add(user); 31 | return new SuccessResult(Messages.UserAdded); 32 | } 33 | 34 | [SecuredOperation("user.update,admin")] 35 | [ValidationAspect(typeof(UserValidator))] 36 | [CacheRemoveAspect("IUserService.Get")] 37 | public IResult Update(User user) 38 | { 39 | _userDal.Update(user); 40 | return new SuccessResult(Messages.UserUpdated); 41 | } 42 | 43 | [SecuredOperation("user.delete,admin")] 44 | [ValidationAspect(typeof(UserValidator))] 45 | public IResult Delete(User user) 46 | { 47 | _userDal.Delete(user); 48 | return new SuccessResult(Messages.UserDeleted); 49 | } 50 | 51 | public IDataResult> GetAll() 52 | { 53 | return new SuccessDataResult>(_userDal.GetAll(), Messages.UsersListed); 54 | } 55 | 56 | [CacheAspect] 57 | [PerformanceAspect(5)] 58 | public IDataResult GetById(int userId) 59 | { 60 | return new SuccessDataResult(_userDal.Get(u => u.UserId == userId)); 61 | } 62 | 63 | public IDataResult> GetClaims(User user) 64 | { 65 | return new SuccessDataResult>(_userDal.GetClaims(user)); 66 | } 67 | 68 | public IDataResult GetByMail(string email) 69 | { 70 | return new SuccessDataResult(_userDal.Get(u => u.Email == email)); 71 | } 72 | 73 | public IResult UpdateInfo(User user) 74 | { 75 | var userToUpdate = GetById(user.UserId).Data; 76 | userToUpdate.FirstName = user.FirstName; 77 | userToUpdate.LastName = user.LastName; 78 | userToUpdate.Email = user.Email; 79 | Update(userToUpdate); 80 | return new SuccessResult(Messages.ProfileUpdated); 81 | } 82 | 83 | [CacheRemoveAspect("IUserService.Get")] 84 | public IResult UpdateUserFindex(int userId) 85 | { 86 | var userToUpdateFindex = _userDal.Get(u => u.UserId == userId); 87 | if(userToUpdateFindex.FindexPoint != 1900) 88 | { 89 | userToUpdateFindex.FindexPoint += 100; 90 | _userDal.Update(userToUpdateFindex); 91 | return new SuccessResult(Messages.EarnedFindex); 92 | } 93 | else 94 | { 95 | userToUpdateFindex.FindexPoint = 1900; 96 | return new SuccessResult(Messages.MaxFindex); 97 | } 98 | 99 | } 100 | 101 | public IDataResult GetUserFindexByUserId(int userId) 102 | { 103 | return new SuccessDataResult(_userDal.Get(u => u.UserId == userId)); 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /Business/Constants/Messages.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Runtime.Serialization; 6 | using System.Text; 7 | 8 | namespace Business.Constants 9 | { 10 | public static class Messages 11 | { 12 | 13 | //Brand Messages 14 | public static string BrandAdded = "Brand Added"; 15 | public static string BrandUpdated = "Brand Updated"; 16 | public static string BrandDeleted = "Brand Deleted"; 17 | public static string BrandsListed = "Brands Listed"; 18 | 19 | //Car Messages 20 | public static string CarAdded = "Car Added"; 21 | public static string CarUpdated = "Car Updated"; 22 | public static string CarDeleted = "Car Deleted"; 23 | public static string CarsListed = "Cars Listed"; 24 | 25 | //Color Messages 26 | public static string ColorAdded = "Color Added"; 27 | public static string ColorUpdated = "Color Updated"; 28 | public static string ColorDeleted = "Color Deleted"; 29 | public static string ColorsListed = "Colors Listed"; 30 | 31 | //User Messages 32 | public static string UserAdded = "User Added"; 33 | public static string UserUpdated = "User Updated"; 34 | public static string UserDeleted = "User Deleted"; 35 | public static string UsersListed = "Users Listed"; 36 | 37 | //Customer Messages 38 | public static string CustomerAdded = "Customer Added"; 39 | public static string CustomerUpdated = "Customer Updated"; 40 | public static string CustomerDeleted = "Customer Deleted"; 41 | public static string CustomersListed = "Customers Listed"; 42 | 43 | //CarImage Messages 44 | public static string CarImageAdded = "Car Image Added"; 45 | public static string CarImageUpdated = "Car Image Updated"; 46 | public static string CarImageDeleted = "Car Image Deleted"; 47 | public static string CarImagesListed = "Car Images Listed"; 48 | public static string[] ValidImageFileTypes = { ".JPG", ".JPEG", ".PNG", ".TIF", ".TIFF", ".GIF", ".BMP", ".ICO" }; 49 | 50 | //Rental Messages 51 | public static string RentalAdded = "Rent Information Added"; 52 | public static string RentalUpdated = "Rent Information Updated"; 53 | public static string RentalDeleted = "Rent Information Deleted"; 54 | public static string RentalsListed = "Rent Information Listed"; 55 | public static string RentalReturned = "Rented Car Returned Successfully"; 56 | 57 | 58 | public static string SuccessfullyPaid = "Payment Successfully"; 59 | 60 | 61 | 62 | //Error Messages 63 | public static string BrandNameInvalid = "Brand Name is Invalid"; 64 | public static string CarNameInvalid = "Car Name is Invalid"; 65 | public static string ColorNameInvalid = "Color Name is Invalid"; 66 | public static string RentalInvalid = "The Car That You Wanted Isn't Available"; 67 | public static string MaintenanceTime = "Maintenance Mode"; 68 | public static string CarImageCountOfCarIdError="A car can have only 5 photos"; 69 | public static string CarImagePathAlreadyExists="Car path is already existed"; 70 | public static string AuthorizationDenied= "Access Denied. You are not authorized."; 71 | public static string UserRegistered = "Kayıt oldu."; 72 | public static string UserNotFound = "Kullanıcı bulunamadı."; 73 | public static string PasswordError = "Parola hatası."; 74 | public static string SuccessfulLogin = "Başarılı giriş."; 75 | public static string UserAlreadyExists = "Kullanıcı mevcut."; 76 | public static string AccessTokenCreated = "Token oluşturuldu."; 77 | public static string FileCannotDelete = "File Can Not Delete."; 78 | public static string CarImageMustBeExists = "Car Image Must Be Exists."; 79 | public static string InvalidImageExtension = "Invalid Image Extension."; 80 | public static string ProfileUpdated = "Profile Updated."; 81 | public static string EarnedFindex = "Earned Findex."; 82 | public static string PaymentSucceeded = "Payment Successfully."; 83 | public static string PaymentError = "Payment Error."; 84 | public static string PasswordChanged = "Password Changed."; 85 | public static string CardAdded = "Card Added."; 86 | public static string MaxFindex="You Reached The Maximum Findex Point"; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /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 System; 11 | using System.Collections.Generic; 12 | using System.Text; 13 | 14 | namespace Business.DependencyResolvers.Autofac 15 | { 16 | public class AutofacBusinessModule : Module 17 | { 18 | protected override void Load(ContainerBuilder builder) 19 | { 20 | builder.RegisterType().As().SingleInstance(); 21 | builder.RegisterType().As().SingleInstance(); 22 | 23 | builder.RegisterType().As().SingleInstance(); 24 | builder.RegisterType().As().SingleInstance(); 25 | 26 | builder.RegisterType().As().SingleInstance(); 27 | builder.RegisterType().As().SingleInstance(); 28 | 29 | builder.RegisterType().As().SingleInstance(); 30 | builder.RegisterType().As().SingleInstance(); 31 | 32 | builder.RegisterType().As().SingleInstance(); 33 | builder.RegisterType().As().SingleInstance(); 34 | 35 | builder.RegisterType().As().SingleInstance(); 36 | builder.RegisterType().As().SingleInstance(); 37 | 38 | builder.RegisterType().As().SingleInstance(); 39 | builder.RegisterType().As().SingleInstance(); 40 | 41 | builder.RegisterType().As().SingleInstance(); 42 | builder.RegisterType().As().SingleInstance(); 43 | 44 | builder.RegisterType().As(); 45 | builder.RegisterType().As(); 46 | 47 | builder.RegisterType().As().SingleInstance(); 48 | builder.RegisterType().As().SingleInstance(); 49 | 50 | //builder.RegisterType().As(); 51 | 52 | var assembly = System.Reflection.Assembly.GetExecutingAssembly(); 53 | 54 | builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces() 55 | .EnableInterfaceInterceptors(new ProxyGenerationOptions() 56 | { 57 | Selector = new AspectInterceptorSelector() 58 | }).SingleInstance(); 59 | 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/BrandValidator.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using FluentValidation; 3 | 4 | namespace Business.ValidationRules.FluentValidation 5 | { 6 | public class BrandValidator : AbstractValidator 7 | { 8 | public BrandValidator() 9 | { 10 | RuleFor(b => b.BrandName).NotEmpty(); 11 | } 12 | } 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /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(ci => ci.CarId).NotNull(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/CarValidator.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using FluentValidation; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Business.ValidationRules.FluentValidation 8 | { 9 | public class CarValidator:AbstractValidator 10 | { 11 | public CarValidator() 12 | { 13 | RuleFor(c => c.CarName).NotEmpty(); 14 | RuleFor(c => c.CarName).MinimumLength(2); 15 | RuleFor(c => c.DailyPrice).NotEmpty(); 16 | RuleFor(c => c.DailyPrice).GreaterThan(0); 17 | RuleFor(c => c.ModelYear).NotEmpty(); 18 | RuleFor(c => c.ModelYear).Must(YearCheck).WithMessage("Model Year Can't Be Less Than 1900"); 19 | } 20 | 21 | private bool YearCheck(string arg) 22 | { 23 | return (arg.StartsWith("19") || arg.StartsWith("20")); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/ColorValidator.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using FluentValidation; 3 | 4 | namespace Business.ValidationRules.FluentValidation 5 | { 6 | public class ColorValidator : AbstractValidator 7 | { 8 | public ColorValidator() 9 | { 10 | RuleFor(co => co.ColorName).NotEmpty(); 11 | } 12 | } 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/CustomerValidator.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using FluentValidation; 3 | 4 | namespace Business.ValidationRules.FluentValidation 5 | { 6 | public class CustomerValidator : AbstractValidator 7 | { 8 | public CustomerValidator() 9 | { 10 | RuleFor(cu => cu.UserId).NotEmpty(); 11 | RuleFor(cu => cu.CompanyName).NotEmpty(); 12 | } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/RentalValidator.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using DataAccess.Abstract; 3 | using DataAccess.Concrete.EntityFramework; 4 | using Entities.Concrete; 5 | using FluentValidation; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Text; 9 | 10 | namespace Business.ValidationRules.FluentValidation 11 | { 12 | public class RentalValidator: AbstractValidator 13 | { 14 | public RentalValidator() 15 | { 16 | RuleFor(r => r.RentDate).NotEmpty(); 17 | RuleFor(r => r.RentDate).GreaterThanOrEqualTo(DateTime.Today).WithMessage("Rent Date can't be earlier than today!!"); 18 | RuleFor(r => r.ReturnDate).GreaterThanOrEqualTo(r => r.RentDate).When(r=>r.ReturnDate.HasValue).WithMessage("Rent Date can't bigger than Return Date!!"); 19 | } 20 | 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/UserValidator.cs: -------------------------------------------------------------------------------- 1 | using Core.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 UserValidator:AbstractValidator 10 | { 11 | public UserValidator() 12 | { 13 | RuleFor(u => u.FirstName).NotEmpty(); 14 | RuleFor(u => u.LastName).NotEmpty(); 15 | //RuleFor(u => u.PasswordHash).NotEmpty(); 16 | //RuleFor(u => u.PasswordHash).MinimumLength(8).WithMessage("Must be at least 8 characters"); 17 | RuleFor(u => u.Email).EmailAddress().WithMessage("Invalid E-Mail address"); 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /ConsoleUI/ConsoleUI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /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.Text; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using System.Linq; 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(x => x?.ToString() ?? ""))})"; 29 | 30 | if (_cacheManager.IsAdd(key)) 31 | { 32 | invocation.ReturnValue = _cacheManager.Get(key); 33 | return; 34 | } 35 | invocation.Proceed(); 36 | _cacheManager.Add(key, invocation.ReturnValue, _duration); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Caching/CacheRemoveAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.CrossCuttingConcerns.Caching; 3 | using Core.Utilities.Interceptors; 4 | using Core.Utilities.IoC; 5 | using Microsoft.Extensions.DependencyInjection; 6 | 7 | namespace Core.Aspects.Autofac.Caching 8 | { 9 | public class CacheRemoveAspect : MethodInterception 10 | { 11 | private string _pattern; 12 | private ICacheManager _cacheManager; 13 | 14 | public CacheRemoveAspect(string pattern) 15 | { 16 | _pattern = pattern; 17 | _cacheManager = ServiceTool.ServiceProvider.GetService(); 18 | } 19 | 20 | protected override void OnSuccess(IInvocation invocation) 21 | { 22 | _cacheManager.RemoveByPattern(_pattern); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Performance/PerformanceAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.Utilities.Interceptors; 3 | using Core.Utilities.IoC; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Diagnostics; 7 | using System.Text; 8 | using Microsoft.Extensions.DependencyInjection; 9 | 10 | namespace Core.Aspects.Autofac.Performance 11 | { 12 | public class PerformanceAspect : MethodInterception 13 | { 14 | private int _interval; 15 | private Stopwatch _stopwatch; 16 | 17 | public PerformanceAspect(int interval) 18 | { 19 | _interval = interval; 20 | _stopwatch = ServiceTool.ServiceProvider.GetService(); 21 | } 22 | 23 | 24 | protected override void OnBefore(IInvocation invocation) 25 | { 26 | _stopwatch.Start(); 27 | } 28 | 29 | protected override void OnAfter(IInvocation invocation) 30 | { 31 | if (_stopwatch.Elapsed.TotalSeconds > _interval) 32 | { 33 | Debug.WriteLine($"Performance : {invocation.Method.DeclaringType.FullName}.{invocation.Method.Name}-->{_stopwatch.Elapsed.TotalSeconds}"); 34 | 35 | } 36 | _stopwatch.Reset(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /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(AspectMessages.WrongValidationType); 20 | throw new System.Exception("Bu bir doğrulama sınıfı değil"); 21 | } 22 | 23 | _validatorType = validatorType; 24 | } 25 | protected override void OnBefore(IInvocation invocation) 26 | { 27 | var validator = (IValidator)Activator.CreateInstance(_validatorType); 28 | var entityType = _validatorType.BaseType.GetGenericArguments()[0]; 29 | var entities = invocation.Arguments.Where(t => t.GetType() == entityType); 30 | foreach (var entity in entities) 31 | { 32 | ValidationTool.Validate(validator, entity); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.Linq; 6 | using System.Text; 7 | using System.Text.RegularExpressions; 8 | using Microsoft.Extensions.DependencyInjection; 9 | 10 | namespace Core.CrossCuttingConcerns.Caching.Microsoft 11 | { 12 | public class MemoryCacheManager : ICacheManager 13 | { 14 | //Adapter Pattern - Adaptasyon Deseni - Varolan bir sistemi kendimize göre ayarlıyoruz. 15 | IMemoryCache _memoryCache; 16 | 17 | 18 | public MemoryCacheManager() 19 | { 20 | _memoryCache = ServiceTool.ServiceProvider.GetService(); 21 | } 22 | 23 | public void Add(string key, object value, int duration) 24 | { 25 | _memoryCache.Set(key, value, TimeSpan.FromMinutes(duration)); 26 | } 27 | 28 | public T Get(string key) 29 | { 30 | return _memoryCache.Get(key); 31 | } 32 | 33 | public object Get(string key) 34 | { 35 | return _memoryCache.Get(key); 36 | } 37 | 38 | public bool IsAdd(string key) 39 | { 40 | return _memoryCache.TryGetValue(key, out _); 41 | } 42 | 43 | public void Remove(string key) 44 | { 45 | _memoryCache.Remove(key); 46 | } 47 | 48 | public void RemoveByPattern(string pattern) 49 | { 50 | var cacheEntriesCollectionDefinition = typeof(MemoryCache).GetProperty("EntriesCollection", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); 51 | var cacheEntriesCollection = cacheEntriesCollectionDefinition.GetValue(_memoryCache) as dynamic; 52 | List cacheCollectionValues = new List(); 53 | 54 | foreach (var cacheItem in cacheEntriesCollection) 55 | { 56 | ICacheEntry cacheItemValue = cacheItem.GetType().GetProperty("Value").GetValue(cacheItem, null); 57 | cacheCollectionValues.Add(cacheItemValue); 58 | } 59 | 60 | var regex = new Regex(pattern, RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase); 61 | var keysToRemove = cacheCollectionValues.Where(d => regex.IsMatch(d.Key.ToString())).Select(d => d.Key).ToList(); 62 | 63 | foreach (var key in keysToRemove) 64 | { 65 | _memoryCache.Remove(key); 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /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 | //return new ErrorResult(Messages.CarNameInvalid); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Core/DataAccess/EntityFramework/EfEntityRepositoryBase.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using Microsoft.EntityFrameworkCore; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace Core.DataAccess.EntityFramework 10 | { 11 | public class EfEntityRepositoryBase:IEntityRepository 12 | where TEntity : class, IEntity, new() 13 | where TContext : DbContext, new() 14 | { 15 | public void Add(TEntity entity) 16 | { 17 | //IDisposable Pattern Implementation of C# 18 | using (TContext context = new TContext()) 19 | { 20 | var addedEntity = context.Entry(entity); 21 | addedEntity.State = EntityState.Added; 22 | context.SaveChanges(); 23 | } 24 | } 25 | public void Update(TEntity entity) 26 | { 27 | using (TContext context = new TContext()) 28 | { 29 | var updatedEntity = context.Entry(entity); 30 | updatedEntity.State = EntityState.Modified; 31 | context.SaveChanges(); 32 | } 33 | } 34 | 35 | public void Delete(TEntity entity) 36 | { 37 | using (TContext context = new TContext()) 38 | { 39 | var deletedEntity = context.Entry(entity); 40 | deletedEntity.State = EntityState.Deleted; 41 | context.SaveChanges(); 42 | } 43 | } 44 | 45 | public TEntity Get(Expression> filter) 46 | { 47 | using (TContext context = new TContext()) 48 | { 49 | return context.Set().SingleOrDefault(filter); 50 | } 51 | } 52 | 53 | public List GetAll(Expression> filter = null) 54 | { 55 | using (TContext context = new TContext()) 56 | { 57 | return filter == null 58 | ? context.Set().ToList() 59 | : context.Set().Where(filter).ToList(); 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Core/DataAccess/IEntityRepository.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | 7 | namespace Core.DataAccess 8 | { 9 | //Generic Constraint - Generic Kısıt 10 | //class : Referans Tip 11 | //IEntity : IEntity olabilir ya da IEntity implemente eden bir nesne olabilir. 12 | //new() : new'lenebilir olmalıdır. Bu sayede IEntity'yi kullanmayı engelliyoruz. 13 | public interface IEntityRepository where T:class, IEntity, new() 14 | { 15 | List GetAll(Expression>filter=null); 16 | 17 | //Tek bir dosya getirmek için aşağıdakini yazmak gerekiyor 18 | T Get(Expression> filter); 19 | void Add(T entity); 20 | void Update(T entity); 21 | void Delete(T entity); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Core/DependencyResolvers/CoreModule.cs: -------------------------------------------------------------------------------- 1 | using Core.CrossCuttingConcerns.Caching; 2 | using Core.CrossCuttingConcerns.Caching.Microsoft; 3 | using Core.Utilities.IoC; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Diagnostics; 9 | using System.Text; 10 | 11 | namespace Core.DependencyResolvers 12 | { 13 | public class CoreModule : ICoreModule 14 | { 15 | public void Load(IServiceCollection services) 16 | { 17 | services.AddMemoryCache(); 18 | services.AddSingleton(); 19 | services.AddSingleton(); 20 | services.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 | public int FindexPoint { get; set; } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Core/Entities/IDto.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Entities 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 | //IEntity implement eden class bir veritabanı tablosudur. 8 | public interface IEntity 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /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.Collections.Generic; 2 | using System.Linq; 3 | using System.Security.Claims; 4 | 5 | namespace Core.Extensions 6 | { 7 | public static class ClaimsPrincipalExtensions 8 | { 9 | public static List Claims(this ClaimsPrincipal claimsPrincipal, string claimType) 10 | { 11 | var result = claimsPrincipal?.FindAll(claimType)?.Select(x => x.Value).ToList(); 12 | return result; 13 | } 14 | 15 | public static List ClaimRoles(this ClaimsPrincipal claimsPrincipal) 16 | { 17 | return claimsPrincipal?.Claims(ClaimTypes.Role); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Core/Extensions/ErrorDetails.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Text; 4 | 5 | namespace Core.Extensions 6 | { 7 | public class ErrorDetails 8 | { 9 | public string Message { get; set; } 10 | public int StatusCode { get; set; } 11 | 12 | 13 | public override string ToString() 14 | { 15 | return JsonConvert.SerializeObject(this); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Core/Extensions/ExceptionMiddleware.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using FluentValidation.Results; 3 | using Microsoft.AspNetCore.Http; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Net; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Core.Extensions 11 | { 12 | public class ExceptionMiddleware 13 | { 14 | private RequestDelegate _next; 15 | 16 | public ExceptionMiddleware(RequestDelegate next) 17 | { 18 | _next = next; 19 | } 20 | 21 | public async Task InvokeAsync(HttpContext httpContext) 22 | { 23 | try 24 | { 25 | await _next(httpContext); 26 | } 27 | catch (Exception e) 28 | { 29 | await HandleExceptionAsync(httpContext, e); 30 | } 31 | } 32 | 33 | private Task HandleExceptionAsync(HttpContext httpContext, Exception e) 34 | { 35 | httpContext.Response.ContentType = "application/json"; 36 | httpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; 37 | 38 | string message = "Internal Server Error"; 39 | IEnumerable errors; 40 | if (e.GetType() == typeof(ValidationException)) 41 | { 42 | message = e.Message; 43 | errors = ((ValidationException)e).Errors; 44 | httpContext.Response.StatusCode = 400; 45 | 46 | return httpContext.Response.WriteAsync(new ValidationErrorDetails 47 | { 48 | StatusCode = 400, 49 | Message = message, 50 | Errors = errors 51 | }.ToString()); 52 | } 53 | 54 | return httpContext.Response.WriteAsync(new ErrorDetails 55 | { 56 | StatusCode = httpContext.Response.StatusCode, 57 | Message = message 58 | }.ToString()); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Core/Extensions/ExceptionMiddlewareExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Extensions 7 | { 8 | public static class ExceptionMiddlewareExtensions 9 | { 10 | public static void ConfigureCustomExceptionMiddleware(this IApplicationBuilder app) 11 | { 12 | app.UseMiddleware(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Core/Extensions/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.IoC; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Core.Extensions 8 | { 9 | public static class ServiceCollectionExtensions 10 | {//apimizin servis bağımlıklarını eklediğimiz koleksiyonun kendisi 11 | public static IServiceCollection AddDependencyResolvers(this IServiceCollection serviceCollection, ICoreModule[] modules) 12 | { 13 | foreach (var module in modules) 14 | { 15 | module.Load(serviceCollection); 16 | } 17 | return ServiceTool.Create(serviceCollection); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Core/Extensions/ValidationErrorDetails.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation.Results; 2 | using System.Collections.Generic; 3 | 4 | namespace Core.Extensions 5 | { 6 | public class ValidationErrorDetails : ErrorDetails 7 | { 8 | public IEnumerable Errors { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /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/Helpers/FileHelper.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Microsoft.AspNetCore.Http; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Text; 7 | 8 | namespace Core.Utilities.Helpers 9 | { 10 | public static class FileHelper 11 | { 12 | public static string Add(IFormFile file) 13 | { 14 | //var sourcepath = Path.GetTempFileName(); 15 | //if (file.Length > 0) 16 | //{ 17 | // using (var stream = new FileStream(sourcepath, FileMode.Create)) 18 | // { 19 | // file.CopyTo(stream); 20 | // } 21 | //} 22 | //var result = newPath(file); 23 | //File.Move(sourcepath, result.newPath); 24 | //return result.Path2.Replace("\\","/"); 25 | 26 | string path = Directory.GetCurrentDirectory() + @"\wwwroot\Images"; 27 | var newGuidPath = Guid.NewGuid() + Path.GetExtension(file.FileName); 28 | string newPath = path + @"\" + newGuidPath; 29 | if (!Directory.Exists(path)) 30 | { 31 | Directory.CreateDirectory(path); 32 | } 33 | 34 | 35 | using (var stream = File.Create(newPath)) 36 | { 37 | file.CopyTo(stream); 38 | stream.Flush(); 39 | } 40 | return newGuidPath; 41 | } 42 | public static void Delete(string path) 43 | { 44 | //path = path.Replace("/", "\\"); 45 | //try 46 | //{ 47 | // File.Delete(path); 48 | //} 49 | //catch (Exception exception) 50 | //{ 51 | // return new ErrorResult(exception.Message); 52 | //} 53 | 54 | //return new SuccessResult(); 55 | 56 | File.Delete(path); 57 | } 58 | public static string Update(IFormFile file, string oldPath) 59 | { 60 | //var result = newPath(file); 61 | //if (sourcePath.Length > 0) 62 | //{ 63 | // using (var stream = new FileStream(result.newPath, FileMode.Create)) 64 | // { 65 | // file.CopyTo(stream); 66 | // } 67 | //} 68 | //File.Delete(sourcePath); 69 | //return result.Path2.Replace("\\", "/"); 70 | 71 | Delete(oldPath); 72 | return Add(file); 73 | 74 | 75 | } 76 | //public static (string newPath, string Path2) newPath(IFormFile file) 77 | //{ 78 | // FileInfo ff = new FileInfo(file.FileName); 79 | // string fileExtension = ff.Extension; 80 | 81 | // string path = Environment.CurrentDirectory + @"\wwwroot\Images"; 82 | // var newPath = Guid.NewGuid().ToString() + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Year + fileExtension; 83 | // //string webPath = string.Format("/Images/{0}",newPath); 84 | 85 | // string result = $@"{path}\{newPath}"; 86 | // return (result, $"{newPath}"); 87 | //} 88 | 89 | 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/AspectInterceptorSelector.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.Aspects.Autofac.Performance; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | 9 | namespace Core.Utilities.Interceptors 10 | { 11 | 12 | public class AspectInterceptorSelector : IInterceptorSelector 13 | { 14 | public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors) 15 | { 16 | var classAttributes = type.GetCustomAttributes 17 | (true).ToList(); 18 | var methodAttributes = type.GetMethod(method.Name) 19 | .GetCustomAttributes(true); 20 | classAttributes.AddRange(methodAttributes); 21 | //classAttributes.Add(new ExceptionLogAspect(typeof(FileLogger))); 22 | classAttributes.Add(new PerformanceAspect(3)); 23 | 24 | return classAttributes.OrderBy(x => x.Priority).ToArray(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /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 collection); 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 | 19 | public T Data { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Core/Utilities/Results/ErrorDataResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class ErrorDataResult : DataResult 8 | { 9 | public ErrorDataResult(T data, string message) : base(data, false, message) 10 | { 11 | 12 | } 13 | public ErrorDataResult(T data) : base(data, false) 14 | { 15 | 16 | } 17 | public ErrorDataResult(string message) : base(default, false, message) 18 | { 19 | 20 | } 21 | public ErrorDataResult() : base(default, false) 22 | { 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Core/Utilities/Results/ErrorResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class ErrorResult:Result 8 | { 9 | public ErrorResult(string message) : base(false, message) 10 | { 11 | } 12 | 13 | public ErrorResult() : base(false) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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 | //Mesajla işlem sonucunu IResult içeriyor bu yüzden tekrar yazmak yerine buraya dahil ediyoruz. 10 | //Mesaj ve işlem sonucu (true, false) dışında birde T türünde data olacak. 11 | T Data { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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 | //Temel voidler için başlangıç 8 | public interface IResult 9 | { 10 | bool Success { get; } 11 | string Message { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/Utilities/Results/Result.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class Result : IResult 8 | { 9 | 10 | public Result(bool success, string message):this(success) 11 | { 12 | Message = message; 13 | } 14 | public Result(bool success) 15 | { 16 | Success = success; 17 | } 18 | 19 | public bool Success {get;} 20 | 21 | public string Message { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | //data and message output 12 | } 13 | public SuccessDataResult(T data) : base(data, true) 14 | { 15 | //only data output 16 | } 17 | public SuccessDataResult(string message) : base(default, true, message) 18 | { 19 | //only message output 20 | } 21 | public SuccessDataResult() : base(default, true) 22 | { 23 | //no output 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 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Encryption/SecurityKeyHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.IdentityModel.Tokens; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Security.Encryption 7 | { 8 | public class SecurityKeyHelper 9 | { 10 | public static SecurityKey CreateSecurityKey(string securityKey) 11 | { 12 | return new SymmetricSecurityKey(Encoding.UTF8.GetBytes(securityKey)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Encryption/SigningCredentialsHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.IdentityModel.Tokens; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Security.Encryption 7 | { 8 | public class SigningCredentialsHelper 9 | { 10 | public static SigningCredentials CreateSigningCredentials(SecurityKey securityKey) 11 | { 12 | return new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha512Signature); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Hashing/HashingHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Security.Hashing 6 | { 7 | public class HashingHelper 8 | { 9 | public static void CreatePasswordHash(string password, out byte[] passwordHash, out byte[] passwordSalt) 10 | { 11 | using (var hmac = new System.Security.Cryptography.HMACSHA512()) 12 | { 13 | passwordSalt = hmac.Key; 14 | passwordHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(password)); 15 | } 16 | 17 | } 18 | public static bool VerifyPasswordHash(string password, byte[] passwordHash, byte[] passwordSalt) 19 | { 20 | using (var hmac = new System.Security.Cryptography.HMACSHA512(passwordSalt)) 21 | { 22 | var computedHash= hmac.ComputeHash(Encoding.UTF8.GetBytes(password)); 23 | for (int i = 0; i < computedHash.Length; i++) 24 | { 25 | if (computedHash[i]!=passwordHash[i]) 26 | { 27 | return false; 28 | 29 | } 30 | } 31 | return true; 32 | } 33 | } 34 | } 35 | } 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 | } 14 | -------------------------------------------------------------------------------- /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 | _accessTokenExpiration = DateTime.Now.AddMinutes(_tokenOptions.AccessTokenExpiration); 25 | //Accessing to WebAPI/appsetting.json and searching TokenOptions. Equalizes the tables 26 | } 27 | public AccessToken CreateToken(User user, List operationClaims) 28 | { 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 | namespace Core.Utilities.Security.JWT 2 | { 3 | public class TokenOptions 4 | { 5 | public string Audience { get; set; } 6 | public string Issuer { get; set; } 7 | public int AccessTokenExpiration { get; set; } 8 | public string SecurityKey { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IBrandDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace DataAccess.Abstract 8 | { 9 | public interface IBrandDal:IEntityRepository 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICarDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | 9 | namespace DataAccess.Abstract 10 | { 11 | public interface ICarDal:IEntityRepository 12 | { 13 | List GetCarDetails(Expression> filter = null); 14 | } 15 | } 16 | 17 | //Code Refactoring 18 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICarImageDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace DataAccess.Abstract 8 | { 9 | public interface ICarImageDal:IEntityRepository 10 | { 11 | bool IsExists(int id); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Abstract/ICardDal.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 ICardDal: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 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 ICustomerDal : IEntityRepository 12 | { 13 | List GetCustomerDetails(Expression> filter = null); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DataAccess/Abstract/IPaymentDal.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 IPaymentDal: 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.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 IUserDal : IEntityRepository 12 | { 13 | //List GetCarDetails(Expression> filter = null); 14 | List GetClaims(User user); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfBrandDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using Microsoft.EntityFrameworkCore; 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.EntityFramework 12 | { 13 | public class EfBrandDal : EfEntityRepositoryBase, IBrandDal 14 | { 15 | 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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 | //NuGet 15 | public class EfCarDal : EfEntityRepositoryBase, ICarDal 16 | { 17 | public List GetCarDetails(Expression> filter = null) 18 | { 19 | using (RentACarDbContext context =new RentACarDbContext()) 20 | { 21 | var result = from c in filter is null ? context.Cars : context.Cars.Where(filter) 22 | join b in context.Brands on c.BrandId equals b.BrandId 23 | join co in context.Colors on c.ColorId equals co.ColorId 24 | //join ci in context.CarImages 25 | //on c.CarId equals ci.CarId 26 | //select new CarDetailDto 27 | //{ 28 | // CarId = c.CarId, 29 | // CarName = c.CarName, 30 | // BrandName = b.BrandName, 31 | // ColorName = co.ColorName, 32 | // DailyPrice = c.DailyPrice, 33 | // ModelYear = c.ModelYear, 34 | // Description = c.Description, 35 | // ImagePath = ci.ImagePath 36 | //}; 37 | select new CarDetailDto 38 | { 39 | CarId = c.CarId, 40 | CarName = c.CarName, 41 | BrandName = b.BrandName, 42 | ColorName = co.ColorName, 43 | DailyPrice = c.DailyPrice, 44 | ModelYear = c.ModelYear, 45 | Description = c.Description, 46 | FindexPoint = c.FindexPoint, 47 | ImagePath = context.CarImages.Where(x => x.CarId == c.CarId).FirstOrDefault().ImagePath, 48 | Status = !(context.Rentals.Any(r => r.CarId == c.CarId && (r.ReturnDate == null || r.ReturnDate > DateTime.Now))), 49 | }; 50 | 51 | return result.ToList(); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /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.Linq; 7 | using System.Text; 8 | 9 | namespace DataAccess.Concrete.EntityFramework 10 | { 11 | public class EfCarImageDal : EfEntityRepositoryBase, ICarImageDal 12 | { 13 | public bool IsExists(int carImageId) 14 | { 15 | using (RentACarDbContext context = new RentACarDbContext()) 16 | { 17 | return context.CarImages.Any(c => c.CarImageId == carImageId); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCardDal.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 EfCardDal:EfEntityRepositoryBase,ICardDal 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfColorDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using Microsoft.EntityFrameworkCore; 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.EntityFramework 12 | { 13 | public class EfColorDal : EfEntityRepositoryBase, IColorDal 14 | { 15 | 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCustomerDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstract; 3 | using Entities.Concrete; 4 | using Entities.DTOs; 5 | using Microsoft.EntityFrameworkCore; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Linq.Expressions; 10 | using System.Text; 11 | 12 | namespace DataAccess.Concrete.EntityFramework 13 | { 14 | public class EfCustomerDal : EfEntityRepositoryBase, ICustomerDal 15 | { 16 | public List GetCustomerDetails(Expression> filter = null) 17 | { 18 | using (RentACarDbContext context = new RentACarDbContext()) 19 | { 20 | var result = from cu in filter is null ? context.Customers : context.Customers.Where(filter) 21 | join u in context.Users 22 | on cu.UserId equals u.UserId 23 | select new CustomerDetailDto 24 | { 25 | CustomerId = cu.CustomerId, 26 | FirstName = u.FirstName, 27 | LastName = u.LastName, 28 | CompanyName = cu.CompanyName, 29 | }; 30 | return result.ToList(); 31 | 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfPaymentDal.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 EfPaymentDal: EfEntityRepositoryBase,IPaymentDal 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 System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Linq.Expressions; 9 | using System.Text; 10 | 11 | namespace DataAccess.Concrete.EntityFramework 12 | { 13 | public class EfRentalDal : EfEntityRepositoryBase, IRentalDal 14 | { 15 | public List GetRentalDetails(Expression> filter = null) 16 | { 17 | using (RentACarDbContext context = new RentACarDbContext()) 18 | { 19 | var result = from r in filter is null ? context.Rentals : context.Rentals.Where(filter) 20 | join cu in context.Customers 21 | on r.CustomerId equals cu.CustomerId 22 | join c in context.Cars 23 | on r.CarId equals c.CarId 24 | join b in context.Brands 25 | on c.BrandId equals b.BrandId 26 | join u in context.Users 27 | on cu.UserId equals u.UserId 28 | select new RentalDetailDto 29 | { 30 | RentalId = r.RentalId, 31 | BrandName = b.BrandName, 32 | FirstName = u.FirstName, 33 | LastName = u.LastName, 34 | CarId = c.CarId, 35 | CompanyName = cu.CompanyName, 36 | RentDate = r.RentDate, 37 | ReturnDate = r.ReturnDate 38 | }; 39 | return result.ToList(); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using Core.Entities.Concrete; 3 | using DataAccess.Abstract; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using System.Linq; 8 | 9 | namespace DataAccess.Concrete.EntityFramework 10 | { 11 | public class EfUserDal : EfEntityRepositoryBase, IUserDal 12 | { 13 | public List GetClaims(User user) 14 | { 15 | using (var context = new RentACarDbContext()) 16 | { 17 | var result = from operationClaim in context.OperationClaims 18 | join userOperationClaim in context.UserOperationClaims 19 | on operationClaim.Id equals userOperationClaim.OperationClaimId 20 | where userOperationClaim.UserId == user.UserId 21 | select new OperationClaim { Id = operationClaim.Id, Name = operationClaim.Name }; 22 | return result.ToList(); 23 | 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/RentACarDbContext.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 | //Context : Db tabloları ile proje class larını bağlamak 11 | public class RentACarDbContext:DbContext 12 | { 13 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 14 | { 15 | optionsBuilder.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=RentACarDb;Trusted_Connection=true"); 16 | } 17 | 18 | public DbSet Cars { get; set; } 19 | public DbSet Colors { get; set; } 20 | public DbSet Brands { get; set; } 21 | public DbSet Rentals { get; set; } 22 | public DbSet Users { get; set; } 23 | public DbSet Customers { get; set; } 24 | public DbSet CarImages { get; set; } 25 | public DbSet OperationClaims { get; set; } 26 | public DbSet UserOperationClaims { get; set; } 27 | public DbSet Payments { get; set; } 28 | public DbSet Cards { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /DataAccess/Concrete/InMemory/InMemoryCarDal.cs: -------------------------------------------------------------------------------- 1 | using DataAccess.Abstract; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Linq.Expressions; 8 | using System.Text; 9 | 10 | namespace DataAccess.Concrete.InMemory 11 | { 12 | public class InMemoryCarDal : ICarDal 13 | { 14 | List _cars; //Global değişken olduğu için _ koyuyoruz 15 | public InMemoryCarDal() 16 | { 17 | _cars = new List { 18 | new Car{CarId=1, BrandId=1, ColorId=1, DailyPrice=59.90M, ModelYear="2000", Description="Minimum 3 günlük kiralanabilir"}, 19 | new Car{CarId=2, BrandId=1, ColorId=2, DailyPrice=64.90M, ModelYear="2005", Description="Minimum 3 günlük kiralanabilir"}, 20 | new Car{CarId=3, BrandId=2, ColorId=3, DailyPrice=69.90M, ModelYear="2005", Description="Minimum 3 günlük kiralanabilir"}, 21 | new Car{CarId=4, BrandId=3, ColorId=2, DailyPrice=89.90M, ModelYear="2020", Description="Minimum 3 günlük kiralanabilir"}, 22 | new Car{CarId=5, BrandId=4, ColorId=4, DailyPrice=79.90M, ModelYear="2015", Description="Minimum 3 günlük kiralanabilir"} 23 | 24 | }; 25 | 26 | } 27 | 28 | 29 | public void Add(Car car) 30 | { 31 | _cars.Add(car); 32 | } 33 | 34 | public void Delete(Car car) 35 | { 36 | Car carToDelete = _cars.SingleOrDefault(c => c.CarId == car.CarId); 37 | 38 | _cars.Remove(car); 39 | } 40 | 41 | public void Update(Car car) 42 | { 43 | Car carToUpdate = _cars.SingleOrDefault(c => c.CarId == car.CarId); 44 | carToUpdate.BrandId = car.BrandId; 45 | carToUpdate.ColorId = car.ColorId; 46 | carToUpdate.DailyPrice = car.DailyPrice; 47 | carToUpdate.ModelYear = car.ModelYear; 48 | carToUpdate.Description = car.Description; 49 | 50 | } 51 | 52 | public List GetAll() 53 | { 54 | return _cars; 55 | } 56 | 57 | public List GetById(int id) 58 | { 59 | return _cars.Where(c => c.CarId == id).ToList(); 60 | } 61 | 62 | public List GetAll(Expression> filter = null) 63 | { 64 | throw new NotImplementedException(); 65 | } 66 | 67 | public Car Get(Expression> filter) 68 | { 69 | throw new NotImplementedException(); 70 | } 71 | 72 | public List GetCarDetails(Expression> filter = null) 73 | { 74 | throw new NotImplementedException(); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /DataAccess/DataAccess.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Entities/Concrete/Brand.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class Brand:IEntity 9 | { 10 | public int BrandId { get; set; } 11 | public string BrandName { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Entities/Concrete/Car.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class Car:IEntity 9 | { 10 | public int CarId { get; set; } 11 | public string CarName { get; set; } 12 | public int BrandId { get; set; } 13 | public int ColorId { get; set; } 14 | public string ModelYear { get; set; } 15 | public decimal DailyPrice { get; set; } 16 | public string Description { get; set; } 17 | public int FindexPoint { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Entities/Concrete/CarImage.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.Concrete 7 | { 8 | public class CarImage:IEntity 9 | { 10 | public int CarImageId { get; set; } 11 | public int CarId { get; set; } 12 | public string ImagePath { get; set; } 13 | public DateTime ImageDate { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Entities/Concrete/Card.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 Card:IEntity 9 | { 10 | public int CardId { get; set; } 11 | public int UserId { get; set; } 12 | public int CVV { get; set; } 13 | public string ExpirationDate { get; set; } 14 | public string FirstName { get; set; } 15 | public string LastName { get; set; } 16 | public string CardNumber { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | } 16 | } 17 | -------------------------------------------------------------------------------- /Entities/Concrete/Payment.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 Payment:IEntity 9 | { 10 | public int PaymentId { get; set; } 11 | public string CardNumber { get; set; } 12 | public string FirstName { get; set; } 13 | public string LastName { get; set; } 14 | public string ExpirationDate { get; set; } 15 | public int CVV { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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 RentalId { 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.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class CarDetailDto : IDto 9 | { 10 | public int CarId { get; set; } 11 | public string CarName { get; set; } 12 | //public int BrandId { get; set; } 13 | public string BrandName { get; set; } 14 | //public int ColorId { get; set; } 15 | public string ColorName { get; set; } 16 | public string ModelYear { get; set; } 17 | public decimal DailyPrice { get; set; } 18 | public string Description { get; set; } 19 | //public int ImageId { get; set; } 20 | public string ImagePath { get; set; } 21 | public bool Status { get; set; } 22 | //public DateTime ImageDate { get; set; } 23 | public int FindexPoint { get; set; } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Entities/DTOs/ChangePasswordDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class ChangePasswordDto:IDto 9 | { 10 | public int UserId { get; set; } 11 | public string OldPassword { get; set; } 12 | public string NewPassword { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Entities/DTOs/CustomerDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class CustomerDetailDto:IDto 9 | { 10 | public int CustomerId { get; set; } 11 | public string FirstName { get; set; } 12 | public string LastName { get; set; } 13 | public string CompanyName { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Entities/DTOs/RentalDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class RentalDetailDto:IDto 9 | { 10 | public int RentalId { get; set; } 11 | public int CarId { get; set; } 12 | public string FirstName { get; set; } 13 | public string LastName { get; set; } 14 | //public string CarName { get; set; } 15 | public string BrandName { get; set; } 16 | public string CompanyName { get; set; } 17 | public DateTime RentDate { get; set; } 18 | public DateTime? ReturnDate { get; set; } 19 | 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Entities/DTOs/UserForLoginDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Entities.DTOs 7 | { 8 | public class UserForLoginDto : IDto 9 | { 10 | public string Email { get; set; } 11 | public string Password { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Entities/DTOs/UserForRegisterDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | 3 | namespace Entities.DTOs 4 | { 5 | public class UserForRegisterDto : IDto 6 | { 7 | public string Email { get; set; } 8 | public string Password { get; set; } 9 | public string FirstName { get; set; } 10 | public string LastName { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Entities/Entities.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![racp](https://user-images.githubusercontent.com/51466724/113709665-72a79b80-96eb-11eb-962d-4deb4c5c0241.jpg) 2 | 3 | [Click For Turkish README File](https://github.com/erkanakkoc/ReCapProject/blob/master/README_TR.md) 4 | 5 | [Click For Front-End Codes](https://github.com/erkanakkoc/ReCapProject-Frontend) 6 | 7 | It's a simple rent a car project. But it will be professional with new updates. 8 | 9 | Here is the list that you can make with this project right now; 10 | 11 | - CRUD operations for Cars, Colors, Brands, Users, Customers and Rentals. 12 | - Authorization Added. You need to be logged in and having a claim for add, update and delete operations 13 | - Working with a real DB (MSSQL) 14 | - EntityFramework files added 15 | - IEntity, IDto, IEntityRepository, EfEntityRepositoryBase added 16 | - Core Layer added 17 | - WebAPI, JWT, IoC, Interceptors,Autofac 18 | 19 | The rules that I tried to follow rules when writing this project 20 | - SOLID Principles, 21 | - Clean Coding, 22 | - DRY (Don't Repeat Yourself) 23 | 24 | 25 | # New Features! 26 | 27 | ## Version 1.9.x 28 | - Code Refactoring for Car, CarImage and Rental 29 | - Authentication System Added 30 | - Payment Service Added 31 | 32 | ## Version 1.8.5 33 | - Autofac ✔ 34 | - New Rules ✔ 35 | - Model Year Must Be Between 1900-2099 36 | - ReturnDate Can't Be Earlier Date Than RentalDate 37 | - RentDate Can't Be Earlier Date Than Today 38 | - FluentValidation (UserValidator, CarValidator, RentalValidator) ✔ 39 | - ValidationAspect ✔ 40 | - AOP ✔ 41 | - Tested on Postman ✔ 42 | 43 | 44 | ## LAYERS 45 | 46 | ### 1) Business Layer 47 | #### - Concrete Classes 48 | 1. [CarManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/CarManager.cs) 49 | 2. [BrandManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/BrandManager.cs) 50 | 3. [ColorManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/ColorManager.cs) 51 | 4. [CustomerManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/CustomerManager.cs) 52 | 5. [UserManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/UserManager.cs) 53 | 6. [RentalManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/RentalManager.cs) 54 | 55 | #### - Abstract Classes 56 | 1. [ICarService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/ICarService.cs) 57 | 2. [IBrandService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/IBrandService.cs) 58 | 3. [IColorService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/IColorService.cs) 59 | 4. [ICustomerService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/ICustomerService.cs) 60 | 5. [IUserService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/IUserService.cs) 61 | 6. [IRentalService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/IRentalService.cs) 62 | 63 | #### - Constants Classes 64 | 1. [Messages.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Constants/Messages.cs) 65 | 66 | #### - DependencyResolvers 67 | 1. [AutofacBusinessModule.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/DependencyResolvers/Autofac/AutofacBusinessModule.cs) 68 | 69 | #### - FluentValidation 70 | 1. [CarValidator.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/ValidationRules/FluentValidation/CarValidator.cs) 71 | 2. [RentalValidator.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/ValidationRules/FluentValidation/RentalValidator.cs) 72 | 3. [UserValidator.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/ValidationRules/FluentValidation/UserValidator.cs) 73 | 74 | 75 | ### 2) DataAccess Layer 76 | #### - EntityFramework 77 | 1. [EfCarDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfCarDal.cs) 78 | 2. [EfBrandDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfBrandDal.cs) 79 | 3. [EfColorDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfColorDal.cs) 80 | 4. [EfCustomerDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfCustomerDal.cs) 81 | 5. [EfUserDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfUserDal.cs) 82 | 6. [EfRentalDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfRentalDal.cs) 83 | 7. [RentACarDbContext.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/RentACarDbContext.cs) 84 | 85 | #### - InMemory 86 | 1. [InMemoryCarDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryCarDal.cs) 87 | 2. [InMemoryBrandDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryBrandDal.cs) 88 | 3. [InMemoryColorDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryColorDal.cs) 89 | 4. [InMemoryCustomerDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryCustomerDal.cs) 90 | 5. [InMemoryUserDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryUserDal.cs) 91 | 6. [InMemoryRentalDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryRentalDal.cs) 92 | 93 | #### - Abstract Classes 94 | 1. [ICarDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/ICarDal.cs) 95 | 2. [IBrandDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IBrandDal.cs) 96 | 3. [IColorDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IColorDal.cs) 97 | 4. [ICustomerDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/ICustomerDal.cs) 98 | 5. [IUserDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IUserDal.cs) 99 | 6. [IRentalDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IRentalDal.cs) 100 | 7. [IEntityRepository.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IEntityRepository.cs) 101 | 102 | ### 3) Entities Layer 103 | #### - Concrete Classes 104 | 1. [Car.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Car.cs) 105 | 2. [Brand.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Brand.cs) 106 | 3. [Color.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Color.cs) 107 | 4. [Customer.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Customer.cs) 108 | 5. [User.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/User.cs) 109 | 6. [Rental.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Rental.cs) 110 | 111 | #### - Abstract Classes 112 | 1. [IEntity.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Abstract/IEntity.cs) 113 | 114 | #### - DTOs Classes 115 | 1. [CarDetailDto.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Abstract/CarDetailDto.cs) 116 | 2. [RentalDetailDto.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Abstract/RentalDetailDto.cs) 117 | 118 | ### 4) Core Layer 119 | #### - DataAccess 120 | 1. [IEntityRepository.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/DataAccess/IEntityRepository.cs) 121 | 2. [EfEntityRepositoryBase.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/DataAccess/EntityFramework/EfEntityRepositoryBase.cs) 122 | 123 | #### - Entities 124 | 1. [IDto.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Entities/IDto.cs) 125 | 2. [IEntity.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Entities/IEntity.cs) 126 | 127 | #### - Utilities 128 | ##### - Interceptors 129 | 1. [AspectInterceptorSelector.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Utilities/Interceptors/AspectInterceptorSelector.cs) 130 | 2. [MethodInterception.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Utilities/Interceptors/MethodInterception.cs) 131 | 3. [MethodInterceptionBaseAttribute.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Utilities/Interceptors/MethodInterceptionBaseAttribute.cs) 132 | 133 | #### - CrossCuttingConcerns 134 | 1. [ValidationTool.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/CrossCuttingConcerns/Validation/ValidationTool.cs) 135 | 136 | 137 | #### - Aspects 138 | 1. [ValidationAspect.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Aspects/Autofac/Validation/ValidationAspect.cs) 139 | 140 | 141 | ### 5) ConsoleUI 142 | 1. [Program.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/ConsoleUI/Program.cs) 143 | 144 | 145 | ## SQL Tables 146 | ![rcp](https://user-images.githubusercontent.com/51466724/108183763-7b341a80-711b-11eb-9f84-110b0998e560.jpg) 147 | 148 | ## OUTPUT 149 | 150 | ![output1](https://user-images.githubusercontent.com/51466724/108192079-e0403e00-7124-11eb-8e0c-bbe5de49be71.jpeg) 151 | -------------------------------------------------------------------------------- /README_TR.md: -------------------------------------------------------------------------------- 1 | 2 | ![racp](https://user-images.githubusercontent.com/51466724/108199343-ea1a6f00-712d-11eb-8a5f-1e58784efd2a.jpg) 3 | 4 | [Click For English README File](https://github.com/erkanakkoc/ReCapProject/blob/master/README.md) 5 | 6 | Basit bir araba kiralama projesidir. Fakat yeni güncellemeler ile tamamen profesyonel bir hal alacaktır. 7 | 8 | Bu projede yapabileceğiniz işlemlerden bazıları; 9 | 10 | - Cars, Colors, Brands, Users, Customers ve Rentals tabloları için CRUD işlemleri 11 | - Gerçek bir veritabanı ile çalışma 12 | - EntityFramework dosyaları eklendi 13 | - IEntity, IDto, IEntityRepository ve EfEntityRepositoryBase eklendi 14 | - Core katmanı eklendi 15 | - Sizin gireceğiniz değerler ile gerçek zamanlı sorgulama yapabileceksiniz. 16 | - WebAPI eklendi 17 | - Controllers eklendi (CarsController, BrandsController, ColorsController, CustomersController, UsersController, RentalsController) 18 | - Business katmanının tüm özellikleri Controllers'a eklendi. 19 | 20 | 21 | # Yeni Özellikler! 22 | 23 | ## Versiyon 1.8.9 24 | - JWT Eklendi 25 | - Kimlik Doğrulama Sistemi Eklendi 26 | - Kodlar tekrardan yapılandırıldı. (UserManager, IUserService, AuthManager) 27 | 28 | ## Versiyon 1.8.5 29 | - Autofac eklendi ✔ 30 | - Yeni kurallar eklendi ✔ 31 | - Aracın Modeli 1900 ile 2099 yılları arasında olabilir 32 | - Arabanın teslim edilme tarihi, kiralanma tarihinden daha eski olamaz 33 | - Aracın kiralanma tarihi bugünden daha eski olamaz 34 | - Eğer aracın teslim tarihi belli ise ileriye dönük aracı kiraya verebiliyoruz. 35 | - FluentValidation (UserValidator, CarValidator, RentalValidator) eklendi ✔ 36 | - ValidationAspect eklendi ✔ 37 | - AOP eklendi ✔ 38 | - Postman'da test edildi. ✔ 39 | 40 | 41 | ## KATMANLAR 42 | 43 | ### 1) Business Katmanı 44 | #### - Concrete 45 | 1. [CarManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/CarManager.cs) 46 | 2. [BrandManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/BrandManager.cs) 47 | 3. [ColorManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/ColorManager.cs) 48 | 4. [CustomerManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/CustomerManager.cs) 49 | 5. [UserManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/UserManager.cs) 50 | 6. [RentalManager.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Concrete/RentalManager.cs) 51 | 52 | #### - Abstract 53 | 1. [ICarService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/ICarService.cs) 54 | 2. [IBrandService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/IBrandService.cs) 55 | 3. [IColorService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/IColorService.cs) 56 | 4. [ICustomerService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/ICustomerService.cs) 57 | 5. [IUserService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/IUserService.cs) 58 | 6. [IRentalService.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Abstract/IRentalService.cs) 59 | 60 | #### - Constants 61 | 1. [Messages.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/Constants/Messages.cs) 62 | 63 | #### - DependencyResolvers 64 | 1. [AutofacBusinessModule.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/DependencyResolvers/Autofac/AutofacBusinessModule.cs) 65 | 66 | #### - FluentValidation 67 | 1. [CarValidator.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/ValidationRules/FluentValidation/CarValidator.cs) 68 | 2. [RentalValidator.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/ValidationRules/FluentValidation/RentalValidator.cs) 69 | 3. [UserValidator.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Business/ValidationRules/FluentValidation/UserValidator.cs) 70 | 71 | 72 | ### 2) DataAccess Katmanı 73 | #### - EntityFramework 74 | 1. [EfCarDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfCarDal.cs) 75 | 2. [EfBrandDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfBrandDal.cs) 76 | 3. [EfColorDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfColorDal.cs) 77 | 4. [EfCustomerDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfCustomerDal.cs) 78 | 5. [EfUserDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfUserDal.cs) 79 | 6. [EfRentalDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/EfRentalDal.cs) 80 | 7. [RentACarDbContext.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/EntityFramework/RentACarDbContext.cs) 81 | 82 | #### - InMemory 83 | 1. [InMemoryCarDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryCarDal.cs) 84 | 2. [InMemoryBrandDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryBrandDal.cs) 85 | 3. [InMemoryColorDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryColorDal.cs) 86 | 4. [InMemoryCustomerDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryCustomerDal.cs) 87 | 5. [InMemoryUserDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryUserDal.cs) 88 | 6. [InMemoryRentalDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Concrete/InMemory/InMemoryRentalDal.cs) 89 | 90 | #### - Abstract 91 | 1. [ICarDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/ICarDal.cs) 92 | 2. [IBrandDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IBrandDal.cs) 93 | 3. [IColorDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IColorDal.cs) 94 | 4. [ICustomerDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/ICustomerDal.cs) 95 | 5. [IUserDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IUserDal.cs) 96 | 6. [IRentalDal.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IRentalDal.cs) 97 | 7. [IEntityRepository.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/DataAccess/Abstract/IEntityRepository.cs) 98 | 99 | ### 3) Entities Katmanı 100 | #### - Concrete 101 | 1. [Car.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Car.cs) 102 | 2. [Brand.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Brand.cs) 103 | 3. [Color.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Color.cs) 104 | 4. [Customer.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Customer.cs) 105 | 5. [User.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/User.cs) 106 | 6. [Rental.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Concrete/Rental.cs) 107 | 108 | #### - Abstract 109 | 1. [IEntity.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Abstract/IEntity.cs) 110 | 111 | #### - DTOs 112 | 1. [CarDetailDto.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Abstract/CarDetailDto.cs) 113 | 2. [RentalDetailDto.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Entities/Abstract/RentalDetailDto.cs) 114 | 115 | ### 4) Core Katmanı 116 | #### - DataAccess 117 | 1. [IEntityRepository.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/DataAccess/IEntityRepository.cs) 118 | 2. [EfEntityRepositoryBase.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/DataAccess/EntityFramework/EfEntityRepositoryBase.cs) 119 | 120 | #### - Entities 121 | 1. [IDto.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Entities/IDto.cs) 122 | 2. [IEntity.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Entities/IEntity.cs) 123 | 124 | #### - Utilities 125 | ##### - Interceptors 126 | 1. [AspectInterceptorSelector.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Utilities/Interceptors/AspectInterceptorSelector.cs) 127 | 2. [MethodInterception.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Utilities/Interceptors/MethodInterception.cs) 128 | 3. [MethodInterceptionBaseAttribute.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Utilities/Interceptors/MethodInterceptionBaseAttribute.cs) 129 | 130 | #### - CrossCuttingConcerns 131 | 1. [ValidationTool.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/CrossCuttingConcerns/Validation/ValidationTool.cs) 132 | 133 | 134 | #### - Aspects 135 | 1. [ValidationAspect.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/Core/Aspects/Autofac/Validation/ValidationAspect.cs) 136 | 137 | 138 | ### 5) ConsoleUI 139 | 1. [Program.cs](https://github.com/erkanakkoc/ReCapProject/blob/master/ConsoleUI/Program.cs) 140 | 141 | 142 | ## SQL Tabloları 143 | ![rcp](https://user-images.githubusercontent.com/51466724/108183763-7b341a80-711b-11eb-9f84-110b0998e560.jpg) 144 | 145 | ## EKRAN GÖRÜNTÜSÜ 146 | 147 | ![output1](https://user-images.githubusercontent.com/51466724/108192079-e0403e00-7124-11eb-8e0c-bbe5de49be71.jpeg) 148 | -------------------------------------------------------------------------------- /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", "{B43A25DB-F55E-4031-B7DF-AE6747952B8F}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Business", "Business\Business.csproj", "{4ADB040A-77C6-4CB7-85AE-BA15E3D70EF1}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Entities", "Entities\Entities.csproj", "{5F0ACEDF-C76B-4BB8-B1F8-E7E27A304B56}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleUI", "ConsoleUI\ConsoleUI.csproj", "{F4980AB6-E3E6-43C5-A666-355ABCF4986A}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{2384B89B-ED6C-46A5-8491-4CB4CB9941D9}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAPI", "WebAPI\WebAPI.csproj", "{BB265640-6478-423E-A67C-FA0CA122CEE0}" 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 | {B43A25DB-F55E-4031-B7DF-AE6747952B8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {B43A25DB-F55E-4031-B7DF-AE6747952B8F}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {B43A25DB-F55E-4031-B7DF-AE6747952B8F}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {B43A25DB-F55E-4031-B7DF-AE6747952B8F}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {4ADB040A-77C6-4CB7-85AE-BA15E3D70EF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {4ADB040A-77C6-4CB7-85AE-BA15E3D70EF1}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {4ADB040A-77C6-4CB7-85AE-BA15E3D70EF1}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {4ADB040A-77C6-4CB7-85AE-BA15E3D70EF1}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {5F0ACEDF-C76B-4BB8-B1F8-E7E27A304B56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {5F0ACEDF-C76B-4BB8-B1F8-E7E27A304B56}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {5F0ACEDF-C76B-4BB8-B1F8-E7E27A304B56}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {5F0ACEDF-C76B-4BB8-B1F8-E7E27A304B56}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {F4980AB6-E3E6-43C5-A666-355ABCF4986A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {F4980AB6-E3E6-43C5-A666-355ABCF4986A}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {F4980AB6-E3E6-43C5-A666-355ABCF4986A}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {F4980AB6-E3E6-43C5-A666-355ABCF4986A}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {2384B89B-ED6C-46A5-8491-4CB4CB9941D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {2384B89B-ED6C-46A5-8491-4CB4CB9941D9}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {2384B89B-ED6C-46A5-8491-4CB4CB9941D9}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {2384B89B-ED6C-46A5-8491-4CB4CB9941D9}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {BB265640-6478-423E-A67C-FA0CA122CEE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {BB265640-6478-423E-A67C-FA0CA122CEE0}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {BB265640-6478-423E-A67C-FA0CA122CEE0}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {BB265640-6478-423E-A67C-FA0CA122CEE0}.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 = {A6D92344-AE98-4748-B010-6ADD9D938867} 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 | 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class AuthController : Controller 15 | { 16 | private IAuthService _authService; 17 | 18 | public AuthController(IAuthService authService) 19 | { 20 | _authService = authService; 21 | } 22 | 23 | [HttpPost("login")] 24 | public ActionResult Login(UserForLoginDto userForLoginDto) 25 | { 26 | var userToLogin = _authService.Login(userForLoginDto); 27 | if (!userToLogin.Success) 28 | { 29 | return BadRequest(userToLogin.Message); 30 | } 31 | 32 | var result = _authService.CreateAccessToken(userToLogin.Data); 33 | if (result.Success) 34 | { 35 | return Ok(result); 36 | } 37 | 38 | return BadRequest(result.Message); 39 | } 40 | 41 | [HttpPost("register")] 42 | public ActionResult Register(UserForRegisterDto userForRegisterDto) 43 | { 44 | var userExists = _authService.UserExists(userForRegisterDto.Email); 45 | if (!userExists.Success) 46 | { 47 | return BadRequest(userExists.Message); 48 | } 49 | 50 | var registerResult = _authService.Register(userForRegisterDto, userForRegisterDto.Password); 51 | var result = _authService.CreateAccessToken(registerResult.Data); 52 | if (result.Success) 53 | { 54 | return Ok(result); 55 | } 56 | 57 | return BadRequest(result.Message); 58 | } 59 | 60 | [HttpPost("changepassword")] 61 | public ActionResult ChangePassword(ChangePasswordDto changePasswordDto) 62 | { 63 | var result = _authService.ChangePassword(changePasswordDto); 64 | if (result.Success) 65 | { 66 | return Ok(result); 67 | } 68 | 69 | return BadRequest(result); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /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 | 34 | [HttpGet("getbyid")] 35 | public IActionResult GetById(int brandId) 36 | { 37 | var result = _brandService.GetById(brandId); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | return BadRequest(result); 43 | } 44 | 45 | [HttpPost("add")] 46 | public IActionResult Add(Brand brand) 47 | { 48 | var result = _brandService.Add(brand); 49 | if (result.Success) 50 | { 51 | return Ok(result); 52 | } 53 | return BadRequest(result); 54 | } 55 | [HttpPost("update")] 56 | public IActionResult Update(Brand brand) 57 | { 58 | var result = _brandService.Update(brand); 59 | if (result.Success) 60 | { 61 | return Ok(result); 62 | } 63 | return BadRequest(result); 64 | } 65 | [HttpPost("delete")] 66 | public IActionResult Delete(Brand brand) 67 | { 68 | var result = _brandService.Delete(brand); 69 | if (result.Success) 70 | { 71 | return Ok(result); 72 | } 73 | return BadRequest(result); 74 | } 75 | 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarImagesController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.Utilities.Business; 3 | using Core.Utilities.Results; 4 | using Entities.Concrete; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.AspNetCore.Http; 7 | using Microsoft.AspNetCore.Mvc; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.IO; 11 | using System.Linq; 12 | using System.Threading.Tasks; 13 | using WebAPI.Models; 14 | 15 | namespace WebAPI.Controllers 16 | { 17 | [Route("api/[controller]")] 18 | [ApiController] 19 | public class CarImagesController : ControllerBase 20 | { 21 | 22 | ICarImageService _carImageService; 23 | 24 | public CarImagesController(ICarImageService carImageService) 25 | { 26 | _carImageService = carImageService; 27 | } 28 | 29 | [HttpGet("getall")] 30 | public IActionResult GetAll() 31 | { 32 | var result = _carImageService.GetAll(); 33 | if (result.Success) 34 | { 35 | return Ok(result); 36 | } 37 | return BadRequest(result); 38 | } 39 | 40 | [HttpGet("getbyid")] 41 | public IActionResult GetById([FromForm(Name = ("Id"))] int Id) 42 | { 43 | var result = _carImageService.Get(Id); 44 | if (result.Success) 45 | { 46 | return Ok(result); 47 | } 48 | return BadRequest(result); 49 | } 50 | 51 | [HttpGet("getimagesbycarid")] 52 | public IActionResult GetImagesById(int carId) 53 | { 54 | var result = _carImageService.GetImagesByCarId(carId); 55 | if (result.Success) 56 | { 57 | return Ok(result); 58 | } 59 | return BadRequest(result); 60 | } 61 | 62 | //[HttpPost("add")] 63 | //public IActionResult AddAsync([FromForm(Name = ("Image"))] IFormFile file, [FromForm] CarImage carImage) 64 | //{ 65 | // var result = _carImageService.Add(file, carImage); 66 | 67 | // if (result.Success) 68 | // { 69 | // return Ok(result); 70 | // } 71 | 72 | // return BadRequest(result); 73 | //} 74 | 75 | 76 | //[HttpPost("delete")] 77 | //public IActionResult Delete([FromForm(Name = ("Id"))] int Id) 78 | //{ 79 | 80 | // var carImage = _carImageService.Get(Id).Data; 81 | 82 | // var result = _carImageService.Delete(carImage); 83 | // if (result.Success) 84 | // { 85 | // return Ok(result); 86 | // } 87 | // return BadRequest(result); 88 | //} 89 | 90 | //[HttpPost("update")] 91 | //public IActionResult Update([FromForm(Name = ("Image"))] IFormFile file, [FromForm(Name = ("Id"))] int Id) 92 | //{ 93 | // var carImage = _carImageService.Get(Id).Data; 94 | // var result = _carImageService.Update(file, carImage); 95 | // if (result.Success) 96 | // { 97 | // return Ok(result); 98 | // } 99 | // return BadRequest(result); 100 | //} 101 | 102 | [HttpPost("add")] 103 | public IActionResult Add([FromForm(Name = ("Image"))] IFormFile file, [FromForm] CarImage carImage) 104 | { 105 | if (file == null) 106 | { 107 | return BadRequest("Photo can't be empty"); 108 | } 109 | var result = _carImageService.Add(carImage, file); 110 | if (result.Success) 111 | { 112 | return Ok(result); 113 | } 114 | return BadRequest(result); 115 | } 116 | 117 | [HttpPost("update")] 118 | public IActionResult Update([FromForm] CarImage carImage, [FromForm(Name = ("Image"))] IFormFile file) 119 | { 120 | var result = _carImageService.Update(carImage, file); 121 | if (result.Success) 122 | { 123 | return Ok(result); 124 | } 125 | return BadRequest(result); 126 | 127 | } 128 | 129 | [HttpPost("delete")] 130 | public IActionResult Delete(CarImage carImage) 131 | { 132 | var result = _carImageService.Delete(carImage); 133 | if (result.Success) 134 | { 135 | return Ok(result); 136 | } 137 | return BadRequest(result); 138 | } 139 | 140 | 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CardsController.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 CardsController : ControllerBase 15 | { 16 | ICardService _cardService; 17 | 18 | public CardsController(ICardService cardService) 19 | { 20 | _cardService = cardService; 21 | } 22 | 23 | [HttpPost("addcard")] 24 | public IActionResult AddCard(Card card) 25 | { 26 | var result = _cardService.AddCard(card); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | 34 | 35 | [HttpGet("getcardsbyuserid")] 36 | public IActionResult GetCardsByUserId(int userId) 37 | { 38 | var result = _cardService.GetCardsByUserId(userId); 39 | if (result.Success) 40 | { 41 | return Ok(result); 42 | } 43 | return BadRequest(result); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading; 9 | using System.Threading.Tasks; 10 | 11 | namespace WebAPI.Controllers 12 | { 13 | [Route("api/[controller]")] 14 | [ApiController] 15 | public class CarsController : ControllerBase 16 | { 17 | ICarService _carService; 18 | 19 | public CarsController(ICarService carService) 20 | { 21 | _carService = carService; 22 | } 23 | 24 | //-----------------------GET------------------------------ 25 | [HttpGet("getall")] 26 | public IActionResult GetAll() 27 | { 28 | var result = _carService.GetAll(); 29 | if (result.Success) 30 | { 31 | return Ok(result); 32 | } 33 | return BadRequest(result); 34 | 35 | 36 | } 37 | 38 | [HttpGet("getbyid")] 39 | public IActionResult GetById(int carId) 40 | { 41 | var result = _carService.GetById(carId); 42 | if (result.Success) 43 | { 44 | return Ok(result); 45 | } 46 | return BadRequest(result); 47 | } 48 | 49 | [HttpGet("getbybrand")] 50 | public IActionResult GetCarsByBrandId(int brandId) 51 | { 52 | var result = _carService.GetCarsByBrandId(brandId); 53 | if (result.Success) 54 | { 55 | return Ok(result); 56 | } 57 | return BadRequest(result); 58 | } 59 | 60 | [HttpGet("getbycolor")] 61 | public IActionResult GetCarsByColorId(int colorId) 62 | { 63 | var result = _carService.GetCarsByColorId(colorId); 64 | if (result.Success) 65 | { 66 | return Ok(result); 67 | } 68 | return BadRequest(result); 69 | } 70 | 71 | [HttpGet("getbyselected")] 72 | public IActionResult GetCarsBySelect(int brandId, int colorId) 73 | { 74 | var result = _carService.GetCarsBySelect(brandId, colorId); 75 | if (result.Success) 76 | { 77 | return Ok(result); 78 | } 79 | return BadRequest(result); 80 | } 81 | 82 | 83 | [HttpGet("getbymodelyear")] 84 | public IActionResult GetByModelYear(string modelYear) 85 | { 86 | var result = _carService.GetByModelYear(modelYear); 87 | if (result.Success) 88 | { 89 | return Ok(result); 90 | } 91 | return BadRequest(result); 92 | } 93 | 94 | [HttpGet("getbydailyprice")] 95 | public IActionResult GetByDailyPrice(decimal min, decimal max) 96 | { 97 | var result = _carService.GetByDailyPrice(min,max); 98 | if (result.Success) 99 | { 100 | return Ok(result); 101 | } 102 | return BadRequest(result); 103 | } 104 | 105 | 106 | [HttpGet("getcardetails")] 107 | public IActionResult GetCarDetails() 108 | { 109 | 110 | var result = _carService.GetCarDetails(); 111 | if (result.Success) 112 | { 113 | return Ok(result); 114 | } 115 | 116 | return BadRequest(result); 117 | } 118 | 119 | [HttpGet("getcardetail")] 120 | public IActionResult GetCarDetail(int carId) 121 | { 122 | 123 | var result = _carService.GetCarDetail(carId); 124 | if (result.Success) 125 | { 126 | return Ok(result); 127 | } 128 | 129 | return BadRequest(result); 130 | } 131 | 132 | [HttpGet("getcarminfindex")] 133 | public IActionResult GetCarMinFindex(int carId) 134 | { 135 | var result = _carService.GetCarFindex(carId); 136 | if (result.Success) 137 | { 138 | return Ok(result); 139 | } 140 | return BadRequest(result); 141 | } 142 | 143 | 144 | 145 | //----------------------POST------------------------ 146 | 147 | [HttpPost("add")] 148 | public IActionResult Add(Car car) 149 | { 150 | var result = _carService.Add(car); 151 | if (result.Success) 152 | { 153 | return Ok(result); 154 | } 155 | return BadRequest(result); 156 | } 157 | 158 | [HttpPost("update")] 159 | public IActionResult Update(Car car) 160 | { 161 | var result = _carService.Update(car); 162 | if (result.Success) 163 | { 164 | return Ok(result); 165 | } 166 | return BadRequest(result); 167 | } 168 | 169 | [HttpPost("delete")] 170 | public IActionResult Delete(Car car) 171 | { 172 | var result = _carService.Delete(car); 173 | if (result.Success) 174 | { 175 | return Ok(result); 176 | } 177 | return BadRequest(result); 178 | } 179 | 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /WebAPI/Controllers/ColorsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class ColorsController : ControllerBase 15 | { 16 | IColorService _colorService; 17 | 18 | public ColorsController(IColorService colorService) 19 | { 20 | _colorService = colorService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _colorService.GetAll(); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | 34 | [HttpGet("getbyid")] 35 | public IActionResult GetById(int colorId) 36 | { 37 | var result = _colorService.GetById(colorId); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | return BadRequest(result); 43 | } 44 | 45 | [HttpPost("add")] 46 | public IActionResult Add(Color color) 47 | { 48 | var result = _colorService.Add(color); 49 | if (result.Success) 50 | { 51 | return Ok(result); 52 | } 53 | return BadRequest(result); 54 | } 55 | 56 | [HttpPost("update")] 57 | public IActionResult Update(Color color) 58 | { 59 | var result = _colorService.Update(color); 60 | if (result.Success) 61 | { 62 | return Ok(result); 63 | } 64 | return BadRequest(result); 65 | } 66 | 67 | [HttpPost("delete")] 68 | public IActionResult Delete(Color color) 69 | { 70 | var result = _colorService.Delete(color); 71 | if (result.Success) 72 | { 73 | return Ok(result); 74 | } 75 | return BadRequest(result); 76 | } 77 | 78 | 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /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 | //-------------------------------------GET--------------------------------- 24 | [HttpGet("getall")] 25 | public IActionResult GetAll() 26 | { 27 | var result = _customerService.GetAll(); 28 | if (result.Success) 29 | { 30 | return Ok(result); 31 | } 32 | return BadRequest(result); 33 | } 34 | 35 | [HttpGet("getbyid")] 36 | public IActionResult GetById(int customerId) 37 | { 38 | var result = _customerService.GetById(customerId); 39 | if (result.Success) 40 | { 41 | return Ok(result); 42 | } 43 | return BadRequest(result); 44 | } 45 | 46 | [HttpGet("getcustomerdetails")] 47 | public IActionResult GetCustomerDetails() 48 | { 49 | var result = _customerService.GetCustomerDetails(); 50 | if (result.Success) 51 | { 52 | return Ok(result); 53 | } 54 | 55 | return BadRequest(result); 56 | } 57 | 58 | [HttpGet("getbyuserid")] 59 | public IActionResult GetByUserId(int id) 60 | { 61 | var result = _customerService.GetByUserId(id); 62 | if (result.Success) 63 | { 64 | return Ok(result); 65 | } 66 | return BadRequest(result); 67 | } 68 | 69 | //---------------------------------------POST-------------------------------- 70 | 71 | [HttpPost("add")] 72 | public IActionResult Add(Customer customer) 73 | { 74 | var result = _customerService.Add(customer); 75 | if (result.Success) 76 | { 77 | return Ok(result); 78 | } 79 | return BadRequest(result); 80 | } 81 | 82 | [HttpPost("update")] 83 | public IActionResult Update(Customer customer) 84 | { 85 | var result = _customerService.Update(customer); 86 | if (result.Success) 87 | { 88 | return Ok(result); 89 | } 90 | return BadRequest(result); 91 | } 92 | 93 | [HttpPost("delete")] 94 | public IActionResult Delete(Customer customer) 95 | { 96 | var result = _customerService.Delete(customer); 97 | if (result.Success) 98 | { 99 | return Ok(result); 100 | } 101 | return BadRequest(result); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /WebAPI/Controllers/FileUploadController.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 | 8 | namespace WebAPI.Controllers 9 | { 10 | [Route("api/[controller]")] 11 | [ApiController] 12 | public class FileUploadController : ControllerBase 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /WebAPI/Controllers/PaymentsController.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 PaymentsController : ControllerBase 15 | { 16 | IPaymentService _paymentService; 17 | 18 | public PaymentsController(IPaymentService paymentService) 19 | { 20 | _paymentService = paymentService; 21 | } 22 | 23 | [HttpPost("add")] 24 | public IActionResult Add(Payment payment) 25 | { 26 | var result = _paymentService.Add(payment); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | 34 | [HttpPost("checkpayment")] 35 | public IActionResult CheckPayment(Payment payment) 36 | { 37 | var result = _paymentService.CheckPayment(payment); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | return BadRequest(result); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /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; 9 | using System.Threading.Tasks; 10 | 11 | namespace WebAPI.Controllers 12 | { 13 | [Route("api/[controller]")] 14 | [ApiController] 15 | public class RentalsController : ControllerBase 16 | { 17 | IRentalService _rentalService; 18 | 19 | public RentalsController(IRentalService rentalService) 20 | { 21 | _rentalService = rentalService; 22 | } 23 | 24 | //-----------------------GET--------------------------- 25 | [HttpGet("getall")] 26 | public IActionResult GetAll() 27 | { 28 | var result = _rentalService.GetAll(); 29 | if (result.Success) 30 | { 31 | return Ok(result); 32 | } 33 | return BadRequest(result); 34 | } 35 | 36 | [HttpGet("getbyid")] 37 | public IActionResult GetById(int rentalId) 38 | { 39 | var result = _rentalService.GetById(rentalId); 40 | if (result.Success) 41 | { 42 | return Ok(result); 43 | } 44 | return BadRequest(result); 45 | } 46 | 47 | [HttpGet("getbycarid")] 48 | public IActionResult GetRentalByCarId(int carId) 49 | { 50 | var result = _rentalService.GetRentalByCarId(carId); 51 | if (result.Success) 52 | { 53 | return Ok(result); 54 | } 55 | return BadRequest(result); 56 | } 57 | 58 | [HttpGet("getbycustomerid")] 59 | public IActionResult GetRentalByCustomerId(int customerId) 60 | { 61 | var result = _rentalService.GetRentalByCustomerId(customerId); 62 | if (result.Success) 63 | { 64 | return Ok(result); 65 | } 66 | return BadRequest(result); 67 | } 68 | 69 | [HttpGet("getbyrentdate")] 70 | public IActionResult GetRentalByRentDate(DateTime rentDate) 71 | { 72 | var result = _rentalService.GetRentalByRentDate(rentDate); 73 | if (result.Success) 74 | { 75 | return Ok(result); 76 | } 77 | return BadRequest(result); 78 | } 79 | 80 | [HttpGet("getbyreturndate")] 81 | public IActionResult GetRentalByReturnDate(DateTime returnDate) 82 | { 83 | var result = _rentalService.GetRentalByReturnDate(returnDate); 84 | if (result.Success) 85 | { 86 | return Ok(result); 87 | } 88 | return BadRequest(result); 89 | } 90 | 91 | [HttpGet("getrentaldetails")] 92 | public IActionResult GetRentalDetails() 93 | { 94 | Thread.Sleep(1000); 95 | 96 | var result = _rentalService.GetRentalDetails(); 97 | 98 | if (result.Success) 99 | { 100 | return Ok(result); 101 | } 102 | 103 | return BadRequest(result); 104 | } 105 | 106 | 107 | 108 | //-----------------------POST-------------------------- 109 | 110 | [HttpPost("add")] 111 | public IActionResult Add(Rental rental) 112 | { 113 | var result = _rentalService.Add(rental); 114 | if (result.Success) 115 | { 116 | return Ok(result); 117 | } 118 | return BadRequest(result); 119 | } 120 | 121 | [HttpPost("update")] 122 | public IActionResult Update(Rental rental) 123 | { 124 | var result = _rentalService.Update(rental); 125 | if (result.Success) 126 | { 127 | return Ok(result); 128 | } 129 | return BadRequest(result); 130 | } 131 | 132 | [HttpPost("delete")] 133 | public IActionResult Delete(Rental rental) 134 | { 135 | var result = _rentalService.Delete(rental); 136 | if (result.Success) 137 | { 138 | return Ok(result); 139 | } 140 | return BadRequest(result); 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /WebAPI/Controllers/UsersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Core.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 UsersController : ControllerBase 15 | { 16 | IUserService _userService; 17 | 18 | public UsersController(IUserService userService) 19 | { 20 | _userService = userService; 21 | } 22 | //-------------------------------------GET------------------------------------ 23 | 24 | [HttpGet("getall")] 25 | public IActionResult GetAll() 26 | { 27 | var result = _userService.GetAll(); 28 | if (result.Success) 29 | { 30 | return Ok(result); 31 | } 32 | return BadRequest(result); 33 | } 34 | 35 | [HttpGet("getclaims")] 36 | public IActionResult GetClaims(User user) 37 | { 38 | var result = _userService.GetClaims(user); 39 | if (result.Success) 40 | { 41 | return Ok(result); 42 | } 43 | return BadRequest(result); 44 | } 45 | 46 | [HttpGet("getbyid")] 47 | public IActionResult GetById(int userId) 48 | { 49 | var result = _userService.GetById(userId); 50 | if (result.Success) 51 | { 52 | return Ok(result); 53 | } 54 | return BadRequest(result); 55 | } 56 | 57 | [HttpGet("getbymail")] 58 | public IActionResult GetByMail(string email) 59 | { 60 | var result = _userService.GetByMail(email); 61 | if (result.Success) 62 | { 63 | return Ok(result); 64 | } 65 | return BadRequest(result); 66 | } 67 | 68 | [HttpGet("getuserfindexbyuserid")] 69 | public IActionResult GetUserFindexByUserId(int userId) 70 | { 71 | var result = _userService.GetById(userId); 72 | if (result.Success) 73 | { 74 | return Ok(result); 75 | } 76 | return BadRequest(result); 77 | } 78 | 79 | [HttpGet("updateuserfindex")] 80 | public IActionResult UpdateUserFindex(int userId) 81 | { 82 | var result = _userService.UpdateUserFindex(userId); 83 | if (result.Success) 84 | { 85 | return Ok(result); 86 | } 87 | return BadRequest(result); 88 | } 89 | 90 | //-------------------------------------POST----------------------------------- 91 | [HttpPost("add")] 92 | public IActionResult Add(User user) 93 | { 94 | var result = _userService.Add(user); 95 | if (result.Success) 96 | { 97 | return Ok(result); 98 | } 99 | return BadRequest(result); 100 | } 101 | 102 | [HttpPost("update")] 103 | public IActionResult Update(User user) 104 | { 105 | var result = _userService.Update(user); 106 | if (result.Success) 107 | { 108 | return Ok(result); 109 | } 110 | return BadRequest(result); 111 | } 112 | 113 | [HttpPost("delete")] 114 | public IActionResult Delete(User user) 115 | { 116 | var result = _userService.Delete(user); 117 | if (result.Success) 118 | { 119 | return Ok(result); 120 | } 121 | return BadRequest(result); 122 | } 123 | 124 | 125 | [HttpPost("updateinfo")] 126 | public IActionResult UpdateInfo(User user) 127 | { 128 | var result = _userService.UpdateInfo(user); 129 | if (result.Success) 130 | { 131 | return Ok(result); 132 | } 133 | return BadRequest(result); 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /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/06a9b754-1afe-4d08-9994-598bfdd7c37a_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/06a9b754-1afe-4d08-9994-598bfdd7c37a_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/419c3e65-bbb2-43a1-b91a-eff414522285_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/419c3e65-bbb2-43a1-b91a-eff414522285_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/469f5114-c14a-4251-9f80-030175d983d4_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/469f5114-c14a-4251-9f80-030175d983d4_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/566cbc49-6813-497e-93c4-e6ea0fc7960b_2_28_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/566cbc49-6813-497e-93c4-e6ea0fc7960b_2_28_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/586e6696-a2ed-4844-a101-799fd914f872_2_27_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/586e6696-a2ed-4844-a101-799fd914f872_2_27_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/77d2249f-9084-45e3-8c56-b964c02b2faf_2_27_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/77d2249f-9084-45e3-8c56-b964c02b2faf_2_27_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/7ea9f24e-64d7-4798-854c-8b4cb6af044f_2_27_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/7ea9f24e-64d7-4798-854c-8b4cb6af044f_2_27_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/8042a53c-d366-4449-850e-c50169dce812_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/8042a53c-d366-4449-850e-c50169dce812_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/985ae33e-78e6-4826-8aeb-7ca2cf94a8c5_2_28_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/985ae33e-78e6-4826-8aeb-7ca2cf94a8c5_2_28_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/9d43881e-731d-41e0-b493-1cc736ac8ff4_2_27_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/9d43881e-731d-41e0-b493-1cc736ac8ff4_2_27_2021.jpg -------------------------------------------------------------------------------- /WebAPI/Images/defaultimage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/Images/defaultimage.jpg -------------------------------------------------------------------------------- /WebAPI/Models/FileUpload.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.Models 8 | { 9 | public class FileUpload 10 | { 11 | public IFormFile files { get; set; } 12 | public IFormFile ffcarId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /WebAPI/Program.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Extensions.DependencyInjection; 3 | using Business.DependencyResolvers.Autofac; 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.Extensions.Configuration; 6 | using Microsoft.Extensions.Hosting; 7 | using Microsoft.Extensions.Logging; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading.Tasks; 12 | 13 | namespace WebAPI 14 | { 15 | public class Program 16 | { 17 | public static void Main(string[] args) 18 | { 19 | CreateHostBuilder(args).Build().Run(); 20 | } 21 | 22 | public static IHostBuilder CreateHostBuilder(string[] args) => 23 | Host.CreateDefaultBuilder(args) 24 | .UseServiceProviderFactory(new AutofacServiceProviderFactory()) 25 | .ConfigureContainer(builder => 26 | { 27 | builder.RegisterModule(new AutofacBusinessModule()); 28 | }) 29 | .ConfigureWebHostDefaults(webBuilder => 30 | { 31 | webBuilder.UseStartup(); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /WebAPI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:56634", 8 | "sslPort": 44337 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.DependencyResolvers; 4 | using Core.Extensions; 5 | using Core.Utilities.IoC; 6 | using Core.Utilities.Security.Encryption; 7 | using Core.Utilities.Security.JWT; 8 | using DataAccess.Abstract; 9 | using DataAccess.Concrete.EntityFramework; 10 | using Microsoft.AspNetCore.Authentication.JwtBearer; 11 | using Microsoft.AspNetCore.Builder; 12 | using Microsoft.AspNetCore.Hosting; 13 | using Microsoft.AspNetCore.Http; 14 | using Microsoft.AspNetCore.HttpsPolicy; 15 | using Microsoft.AspNetCore.Mvc; 16 | using Microsoft.Extensions.Configuration; 17 | using Microsoft.Extensions.DependencyInjection; 18 | using Microsoft.Extensions.Hosting; 19 | using Microsoft.Extensions.Logging; 20 | using Microsoft.IdentityModel.Tokens; 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Threading.Tasks; 25 | 26 | namespace WebAPI 27 | { 28 | public class Startup 29 | { 30 | public Startup(IConfiguration configuration) 31 | { 32 | Configuration = configuration; 33 | } 34 | 35 | public IConfiguration Configuration { get; } 36 | 37 | // This method gets called by the runtime. Use this method to add services to the container. 38 | public void ConfigureServices(IServiceCollection services) 39 | { 40 | services.AddControllers(); 41 | //services.AddSingleton(); 42 | //services.AddSingleton(); 43 | 44 | //services.AddSingleton(); 45 | //services.AddSingleton(); 46 | 47 | //services.AddSingleton(); 48 | //services.AddSingleton(); 49 | 50 | //services.AddSingleton(); 51 | //services.AddSingleton(); 52 | 53 | //services.AddSingleton(); 54 | //services.AddSingleton(); 55 | 56 | //services.AddSingleton(); 57 | //services.AddSingleton(); 58 | services.AddCors(); 59 | 60 | 61 | var tokenOptions = Configuration.GetSection("TokenOptions").Get(); 62 | 63 | services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) 64 | .AddJwtBearer(options => 65 | { 66 | options.TokenValidationParameters = new TokenValidationParameters 67 | { 68 | ValidateIssuer = true, 69 | ValidateAudience = true, 70 | ValidateLifetime = true, 71 | ValidIssuer = tokenOptions.Issuer, 72 | ValidAudience = tokenOptions.Audience, 73 | ValidateIssuerSigningKey = true, 74 | IssuerSigningKey = SecurityKeyHelper.CreateSecurityKey(tokenOptions.SecurityKey) 75 | }; 76 | }); 77 | services.AddDependencyResolvers(new ICoreModule[] { 78 | new CoreModule() 79 | 80 | }); 81 | 82 | 83 | 84 | } 85 | 86 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 87 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 88 | { 89 | if (env.IsDevelopment()) 90 | { 91 | app.UseDeveloperExceptionPage(); 92 | } 93 | 94 | app.ConfigureCustomExceptionMiddleware(); 95 | 96 | app.UseCors(builder => builder.WithOrigins("http://localhost:4200").AllowAnyHeader().AllowAnyOrigin()); 97 | 98 | app.UseHttpsRedirection(); 99 | 100 | app.UseRouting(); 101 | 102 | app.UseStaticFiles(); 103 | 104 | app.UseAuthentication(); 105 | 106 | app.UseAuthorization(); 107 | 108 | app.UseEndpoints(endpoints => 109 | { 110 | endpoints.MapControllers(); 111 | }); 112 | 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /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 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /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": "erkan@erkan.com", 4 | "Issuer": "erkan@erkan.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/2b1a667a-7df4-4fc3-b47c-58d87b859de5_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/2b1a667a-7df4-4fc3-b47c-58d87b859de5_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/2c380fa9-de9a-49ae-a7a2-b1f41424a5a1_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/2c380fa9-de9a-49ae-a7a2-b1f41424a5a1_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/356f0aef-76f0-4046-ae9e-4f4a96b8f5b4_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/356f0aef-76f0-4046-ae9e-4f4a96b8f5b4_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/4bccf739-c461-45dc-b13f-f2e323a01a12_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/4bccf739-c461-45dc-b13f-f2e323a01a12_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/55d11189-0299-49ee-8e4a-f67a49a26693_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/55d11189-0299-49ee-8e4a-f67a49a26693_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/62e16810-9eb2-476b-afc5-3339bfd68fab_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/62e16810-9eb2-476b-afc5-3339bfd68fab_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/6cc7e970-a408-4f67-9bae-14d4754b51e4_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/6cc7e970-a408-4f67-9bae-14d4754b51e4_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/76643d65-3c36-4c12-ba64-d9a9f6ccd051.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/76643d65-3c36-4c12-ba64-d9a9f6ccd051.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/92e6aa07-63e3-4093-b0d2-b89b644cb0ef_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/92e6aa07-63e3-4093-b0d2-b89b644cb0ef_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/97e8ebbc-a444-4ae5-9726-c234e48795bb_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/97e8ebbc-a444-4ae5-9726-c234e48795bb_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/9b87999d-e638-4a34-b72d-969e41b1765d_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/9b87999d-e638-4a34-b72d-969e41b1765d_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a7d5512c-6b50-466f-9674-e6568a3816d6_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/a7d5512c-6b50-466f-9674-e6568a3816d6_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ad57642a-e566-43ac-9215-10c4908d0d75_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/ad57642a-e566-43ac-9215-10c4908d0d75_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/b3056f03-a41f-4eeb-988f-052c43a907fa_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/b3056f03-a41f-4eeb-988f-052c43a907fa_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/c4cb7f7f-5e49-48b6-a59f-4aa873b2e660_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/c4cb7f7f-5e49-48b6-a59f-4aa873b2e660_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/default.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/e0e763e2-6013-44d2-b729-9b652a8b41f7_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/e0e763e2-6013-44d2-b729-9b652a8b41f7_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/e98e65f1-607e-462d-a179-6566616215ea.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/e98e65f1-607e-462d-a179-6566616215ea.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/f9466911-d9fa-4a77-ae74-3f34b07a90bc_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/f9466911-d9fa-4a77-ae74-3f34b07a90bc_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/fa9ebd06-d4d1-473b-9c2b-bb07c2e8d4e4_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/fa9ebd06-d4d1-473b-9c2b-bb07c2e8d4e4_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/fc7a0464-8f54-4ad2-8770-29cc5c0216b8_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/fc7a0464-8f54-4ad2-8770-29cc5c0216b8_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ffe3e3ee-fcdd-40bf-a49d-629101e8749e_3_16_2021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/Images/ffe3e3ee-fcdd-40bf-a49d-629101e8749e_3_16_2021.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/uploads/50c518ca1f394960aa522f121cf908b5_2021_2_26.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject/ee359ba73864c46a4e12851f4346c9089d3644f7/WebAPI/wwwroot/uploads/50c518ca1f394960aa522f121cf908b5_2021_2_26.jpg --------------------------------------------------------------------------------