├── WebAPI ├── wwwroot │ └── Images │ │ ├── logo.jpg │ │ ├── 00f6537f-eb18-418b-a7e7-c138ca3d25f7.jpg │ │ ├── 03d73a38-6aa2-434f-a179-0afbde158b8d.jpeg │ │ ├── 046a7457-e63e-4a38-af70-4ebdce49677b.jpeg │ │ ├── 0a64fd43-0f5b-495c-87c7-e2aaf526e458.jpg │ │ ├── 0e5e15bf-7361-428d-a010-8adb4a4d4d09.jpg │ │ ├── 0f8d9551-1a6d-4e75-90c9-2e9660cc9ae9.jpg │ │ ├── 11fc2bb5-48a8-4287-b971-d53a9296a8e6.jpg │ │ ├── 1dfcc870-81bf-4955-9304-dabb44f05b90.jpg │ │ ├── 2456fea3-8845-4431-942b-524f8d970c57.jpg │ │ ├── 26aa8351-e391-4838-9a6d-1dc7f03c1dca.jpg │ │ ├── 276ecf1f-ffc6-4d64-9b8b-8c0b8932a078.jpg │ │ ├── 2928e091-1850-43d2-90c5-a993815de67f.jpg │ │ ├── 2b106a61-b525-42c9-8a6b-8a1bf96916fd.jpeg │ │ ├── 33d54336-6435-4159-b6ea-ce5ea354482b.jpg │ │ ├── 34fd7ae3-02d8-446f-8fca-26399c3ca90b.jpg │ │ ├── 350ad9ff-4d67-45f5-8b3e-d279399a2adc.jpg │ │ ├── 3b360504-28ce-4fe3-ab7d-79878898e511.jpg │ │ ├── 3ceba2f4-c233-4f4e-984b-797ddb7661a4.jpg │ │ ├── 40fc33e8-d6e2-463f-b8fd-d67d1cce6794.jpg │ │ ├── 49f05e92-889a-42c7-a8f9-d04e1c0a0980.jpg │ │ ├── 565c98c3-4b3d-4901-af2b-48d280e5933d.jpg │ │ ├── 5dccfafb-cf40-44c0-997c-0137a4e3dbd5.jpg │ │ ├── 5e26cb8f-8193-48f3-90fb-38d22dcc3650.jpg │ │ ├── 6092ed7e-0828-44a4-99f5-1ab300994e0d.jpg │ │ ├── 65d02cc9-5ee0-4693-9ce6-7802ca372b41.jpg │ │ ├── 68e2fc27-2052-4a5c-a94e-80fd242835bf.jpg │ │ ├── 692a04c9-3a9e-4d68-b892-b523f27378e6.jpg │ │ ├── 692ca5c8-d9e6-4fe2-9a25-993bb64536f6.jpg │ │ ├── 74244231-e447-458f-b7d9-357d21614b0a.jpg │ │ ├── 7465deb0-a315-4dcd-91b9-e6c174618445.jpeg │ │ ├── 7a3df2a6-7aa5-45d1-9d41-0dbe51d092d7.jpg │ │ ├── 858ab55f-b576-4298-93b4-3cc2a7ba0c4f.jpg │ │ ├── 887c752d-0987-412c-a858-3f3c2d208075.jpg │ │ ├── 8c605ffb-357d-4a5e-a055-a173ca1fb593.jpg │ │ ├── 8fa3b8fc-2eb0-4837-bb9e-462c0c335ff7.jpg │ │ ├── 980e2174-0ffc-41a4-844f-85a3268f7ae4.jpg │ │ ├── 9b61af7c-aff2-450e-bf37-8280a34c5fe2.jpg │ │ ├── 9c89ee69-00a3-4a9a-bfe0-81d5b31a7564.jpg │ │ ├── a0f2aadb-4d31-457c-bf63-a2c06377bf0c.jpeg │ │ ├── a489aebe-cd48-4f25-9882-701b87adce01.jpg │ │ ├── a6ca8af4-cf13-458e-9afe-b54607d382fc.jpg │ │ ├── a88edb6e-02e1-4822-8861-8a722b0dda1b.jpg │ │ ├── ca6442e1-43fb-4fcc-bc33-052fd29e3a46.jpg │ │ ├── ce49b53c-188c-4dfa-bf02-c1b428dd25aa.jpg │ │ ├── cea17cd1-0840-46c7-81ae-218e0c6cc590.jpg │ │ ├── d07a1927-e921-40ad-8304-73a3c2431862.jpg │ │ ├── da340b5f-803c-4019-8cad-64eb158dd35a.jpg │ │ ├── dcebee70-f238-466f-9f5d-31eab4b86b35.jpg │ │ ├── e1d32560-9ae4-4116-bdbc-635ba1f2ef33.jpg │ │ ├── e1eb6b29-1c66-4a34-9a26-3778781ff5c6.jpg │ │ ├── e3e9db9f-c2e1-4821-a721-6239a49a2993.jpg │ │ ├── f2dad1f6-66ef-440b-89c7-dd2f0052a50d.jpg │ │ ├── f78d6402-38f8-43a4-a397-9a3de7409c02.jpg │ │ ├── f8e565a2-77f1-48c6-befd-e0aef050c2ff.jpg │ │ ├── fe506da1-ffac-48e1-9868-eeaa0c257670.jpg │ │ ├── fe78d88b-d9bb-4d84-90d8-c314f796121f.jpg │ │ └── ff554a87-622c-4ab0-b4e7-c34683b5523d.jpg ├── appsettings.Development.json ├── WeatherForecast.cs ├── appsettings.json ├── Properties │ └── launchSettings.json ├── Program.cs ├── Controllers │ ├── WeatherForecastController.cs │ ├── UsersController.cs │ ├── ColorsController.cs │ ├── BrandsController.cs │ ├── RentalsController.cs │ ├── CustomersController.cs │ ├── CarImagesController.cs │ ├── FakeCardsController.cs │ └── CarsController.cs ├── WebAPI.csproj └── Startup.cs ├── Console ├── Class1.cs └── Console.csproj ├── Core ├── Entities │ ├── IDto.cs │ ├── IEntity.cs │ └── Concrete │ │ ├── OperationClaim.cs │ │ ├── UserOperationClaim.cs │ │ └── User.cs ├── CrossCuttingConcerns │ ├── Logging │ │ ├── LogDetailWithException.cs │ │ ├── LogParameter.cs │ │ ├── LogDetail.cs │ │ └── Log4Net │ │ │ ├── Loggers │ │ │ ├── FileLogger.cs │ │ │ └── DatabaseLogger.cs │ │ │ ├── SerializableLogEvent.cs │ │ │ ├── Layouts │ │ │ └── JsonLayout.cs │ │ │ └── LoggerServiceBase.cs │ ├── Caching │ │ ├── ICacheManager.cs │ │ └── Microsoft │ │ │ └── MemoryCacheManager.cs │ └── Validation │ │ └── ValidationTool.cs ├── Utilities │ ├── IoC │ │ ├── ICoreModule.cs │ │ └── ServiceTool.cs │ ├── Results │ │ ├── IDataResult.cs │ │ ├── IResult.cs │ │ ├── ErrorResult.cs │ │ ├── SuccessResult.cs │ │ ├── Result.cs │ │ ├── DataResult.cs │ │ ├── ErrorDataResult.cs │ │ └── SuccessDataResult.cs │ ├── Security │ │ ├── JWT │ │ │ ├── AccessToken.cs │ │ │ ├── ITokenHelper.cs │ │ │ ├── TokenOptions.cs │ │ │ └── JwtHelper.cs │ │ ├── Encrypiton │ │ │ ├── SigningCredentialsHelper.cs │ │ │ └── SecurityKeyHelper.cs │ │ └── Hashing │ │ │ └── HashingHelper.cs │ ├── Messages │ │ └── AspectMessages.cs │ ├── Business │ │ └── BusinessRules.cs │ ├── Interceptors │ │ ├── MethodInterceptionBaseAttribute.cs │ │ ├── AspectInterceptorSelector.cs │ │ └── MethodInterception.cs │ └── FileHelpers │ │ └── FileHelper.cs ├── Extensions │ ├── ExceptionMiddlewareExtensions.cs │ ├── ErrorDetails.cs │ ├── ServiceCollectionExtensions.cs │ ├── ClaimsPrincipalExtensions.cs │ ├── ClaimExtensions.cs │ └── ExceptionMiddleware.cs ├── DataAccess │ ├── IEntityRepository.cs │ └── EntityFramework │ │ └── EfEntityRepositoryBase.cs ├── DependencyResolvers │ └── CoreModule.cs ├── Aspects │ └── Autofac │ │ ├── Caching │ │ ├── CacheRemoveAspect.cs │ │ └── CacheAspect.cs │ │ ├── Transaction │ │ └── TransactionScopeAspect.cs │ │ ├── Perfromanca │ │ └── PerformanceAspect.cs │ │ ├── Validation │ │ └── ValidationAspect.cs │ │ ├── Logging │ │ └── LogAspect.cs │ │ └── Exception │ │ └── ExceptionLogAspect.cs └── Core.csproj ├── Entities ├── DTOs │ ├── UserForLoginDto.cs │ ├── UserForRegisterDto.cs │ ├── CustomerDetailDto.cs │ ├── CarDetailDto.cs │ └── RentalDetailDto.cs ├── Concrete │ ├── Brand.cs │ ├── Color.cs │ ├── Customer.cs │ ├── CarImage.cs │ ├── Rental.cs │ ├── FakeCard.cs │ └── Car.cs └── Entities.csproj ├── DataAccess ├── Concrete │ └── EntityFramework │ │ ├── EfEntityRepositoryBase.cs │ │ ├── EfFakeCardDal.cs │ │ ├── EfCarImagesDal.cs │ │ ├── EfBrandDal.cs │ │ ├── EfColorDal.cs │ │ ├── EfUserDal.cs │ │ ├── CarDbContext.cs │ │ ├── EfCustomerDal.cs │ │ ├── EfRentalDal.cs │ │ └── EfCarDal.cs ├── Abstack │ ├── IBrandDal.cs │ ├── IColorDal.cs │ ├── ICarImagesDal .cs │ ├── IFakeCardDal.cs │ ├── IUserDal.cs │ ├── IRentalDal.cs │ ├── ICustomerDal.cs │ └── ICarDal.cs └── DataAccess.csproj ├── Business ├── Abstack │ ├── IUserService.cs │ ├── IColorService.cs │ ├── IBrandService.cs │ ├── IAuthService.cs │ ├── ICarImageService.cs │ ├── IFakeCardService.cs │ ├── ICustomerService.cs │ ├── IRentalService.cs │ └── ICarService.cs ├── ValidationRules │ └── FluentValidation │ │ ├── CarImageValidator.cs │ │ ├── BrandValidator.cs │ │ ├── ColorValidator.cs │ │ ├── RentalValidator.cs │ │ └── CarValidator.cs ├── Business.csproj ├── Concrete │ ├── UserManager.cs │ ├── ColorManager.cs │ ├── BrandManager.cs │ ├── FakeCardManager.cs │ ├── CustomerManager.cs │ ├── AuthManager.cs │ ├── RentalManager.cs │ ├── CarImageManager.cs │ └── CarManager.cs ├── BusinessAspect │ └── Autofac │ │ └── SecuredOperation.cs ├── DependencyResolvers │ └── Autofac │ │ └── AutofacBusinessModule.cs └── Constants │ └── Messages.cs ├── ConsolePrj ├── ConsolePrj.csproj └── Program.cs ├── .gitattributes ├── ReCapProjectSon.sln └── .gitignore /WebAPI/wwwroot/Images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/logo.jpg -------------------------------------------------------------------------------- /Console/Class1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Console 4 | { 5 | public class Class1 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/00f6537f-eb18-418b-a7e7-c138ca3d25f7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/00f6537f-eb18-418b-a7e7-c138ca3d25f7.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/03d73a38-6aa2-434f-a179-0afbde158b8d.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/03d73a38-6aa2-434f-a179-0afbde158b8d.jpeg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/046a7457-e63e-4a38-af70-4ebdce49677b.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/046a7457-e63e-4a38-af70-4ebdce49677b.jpeg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/0a64fd43-0f5b-495c-87c7-e2aaf526e458.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/0a64fd43-0f5b-495c-87c7-e2aaf526e458.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/0e5e15bf-7361-428d-a010-8adb4a4d4d09.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/0e5e15bf-7361-428d-a010-8adb4a4d4d09.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/0f8d9551-1a6d-4e75-90c9-2e9660cc9ae9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/0f8d9551-1a6d-4e75-90c9-2e9660cc9ae9.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/11fc2bb5-48a8-4287-b971-d53a9296a8e6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/11fc2bb5-48a8-4287-b971-d53a9296a8e6.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/1dfcc870-81bf-4955-9304-dabb44f05b90.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/1dfcc870-81bf-4955-9304-dabb44f05b90.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/2456fea3-8845-4431-942b-524f8d970c57.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/2456fea3-8845-4431-942b-524f8d970c57.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/26aa8351-e391-4838-9a6d-1dc7f03c1dca.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/26aa8351-e391-4838-9a6d-1dc7f03c1dca.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/276ecf1f-ffc6-4d64-9b8b-8c0b8932a078.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/276ecf1f-ffc6-4d64-9b8b-8c0b8932a078.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/2928e091-1850-43d2-90c5-a993815de67f.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/2928e091-1850-43d2-90c5-a993815de67f.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/2b106a61-b525-42c9-8a6b-8a1bf96916fd.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/2b106a61-b525-42c9-8a6b-8a1bf96916fd.jpeg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/33d54336-6435-4159-b6ea-ce5ea354482b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/33d54336-6435-4159-b6ea-ce5ea354482b.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/34fd7ae3-02d8-446f-8fca-26399c3ca90b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/34fd7ae3-02d8-446f-8fca-26399c3ca90b.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/350ad9ff-4d67-45f5-8b3e-d279399a2adc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/350ad9ff-4d67-45f5-8b3e-d279399a2adc.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/3b360504-28ce-4fe3-ab7d-79878898e511.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/3b360504-28ce-4fe3-ab7d-79878898e511.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/3ceba2f4-c233-4f4e-984b-797ddb7661a4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/3ceba2f4-c233-4f4e-984b-797ddb7661a4.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/40fc33e8-d6e2-463f-b8fd-d67d1cce6794.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/40fc33e8-d6e2-463f-b8fd-d67d1cce6794.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/49f05e92-889a-42c7-a8f9-d04e1c0a0980.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/49f05e92-889a-42c7-a8f9-d04e1c0a0980.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/565c98c3-4b3d-4901-af2b-48d280e5933d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/565c98c3-4b3d-4901-af2b-48d280e5933d.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/5dccfafb-cf40-44c0-997c-0137a4e3dbd5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/5dccfafb-cf40-44c0-997c-0137a4e3dbd5.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/5e26cb8f-8193-48f3-90fb-38d22dcc3650.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/5e26cb8f-8193-48f3-90fb-38d22dcc3650.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/6092ed7e-0828-44a4-99f5-1ab300994e0d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/6092ed7e-0828-44a4-99f5-1ab300994e0d.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/65d02cc9-5ee0-4693-9ce6-7802ca372b41.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/65d02cc9-5ee0-4693-9ce6-7802ca372b41.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/68e2fc27-2052-4a5c-a94e-80fd242835bf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/68e2fc27-2052-4a5c-a94e-80fd242835bf.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/692a04c9-3a9e-4d68-b892-b523f27378e6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/692a04c9-3a9e-4d68-b892-b523f27378e6.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/692ca5c8-d9e6-4fe2-9a25-993bb64536f6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/692ca5c8-d9e6-4fe2-9a25-993bb64536f6.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/74244231-e447-458f-b7d9-357d21614b0a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/74244231-e447-458f-b7d9-357d21614b0a.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/7465deb0-a315-4dcd-91b9-e6c174618445.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/7465deb0-a315-4dcd-91b9-e6c174618445.jpeg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/7a3df2a6-7aa5-45d1-9d41-0dbe51d092d7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/7a3df2a6-7aa5-45d1-9d41-0dbe51d092d7.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/858ab55f-b576-4298-93b4-3cc2a7ba0c4f.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/858ab55f-b576-4298-93b4-3cc2a7ba0c4f.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/887c752d-0987-412c-a858-3f3c2d208075.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/887c752d-0987-412c-a858-3f3c2d208075.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/8c605ffb-357d-4a5e-a055-a173ca1fb593.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/8c605ffb-357d-4a5e-a055-a173ca1fb593.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/8fa3b8fc-2eb0-4837-bb9e-462c0c335ff7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/8fa3b8fc-2eb0-4837-bb9e-462c0c335ff7.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/980e2174-0ffc-41a4-844f-85a3268f7ae4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/980e2174-0ffc-41a4-844f-85a3268f7ae4.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/9b61af7c-aff2-450e-bf37-8280a34c5fe2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/9b61af7c-aff2-450e-bf37-8280a34c5fe2.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/9c89ee69-00a3-4a9a-bfe0-81d5b31a7564.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/9c89ee69-00a3-4a9a-bfe0-81d5b31a7564.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a0f2aadb-4d31-457c-bf63-a2c06377bf0c.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/a0f2aadb-4d31-457c-bf63-a2c06377bf0c.jpeg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a489aebe-cd48-4f25-9882-701b87adce01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/a489aebe-cd48-4f25-9882-701b87adce01.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a6ca8af4-cf13-458e-9afe-b54607d382fc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/a6ca8af4-cf13-458e-9afe-b54607d382fc.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/a88edb6e-02e1-4822-8861-8a722b0dda1b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/a88edb6e-02e1-4822-8861-8a722b0dda1b.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ca6442e1-43fb-4fcc-bc33-052fd29e3a46.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/ca6442e1-43fb-4fcc-bc33-052fd29e3a46.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ce49b53c-188c-4dfa-bf02-c1b428dd25aa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/ce49b53c-188c-4dfa-bf02-c1b428dd25aa.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/cea17cd1-0840-46c7-81ae-218e0c6cc590.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/cea17cd1-0840-46c7-81ae-218e0c6cc590.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/d07a1927-e921-40ad-8304-73a3c2431862.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/d07a1927-e921-40ad-8304-73a3c2431862.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/da340b5f-803c-4019-8cad-64eb158dd35a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/da340b5f-803c-4019-8cad-64eb158dd35a.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/dcebee70-f238-466f-9f5d-31eab4b86b35.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/dcebee70-f238-466f-9f5d-31eab4b86b35.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/e1d32560-9ae4-4116-bdbc-635ba1f2ef33.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/e1d32560-9ae4-4116-bdbc-635ba1f2ef33.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/e1eb6b29-1c66-4a34-9a26-3778781ff5c6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/e1eb6b29-1c66-4a34-9a26-3778781ff5c6.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/e3e9db9f-c2e1-4821-a721-6239a49a2993.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/e3e9db9f-c2e1-4821-a721-6239a49a2993.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/f2dad1f6-66ef-440b-89c7-dd2f0052a50d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/f2dad1f6-66ef-440b-89c7-dd2f0052a50d.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/f78d6402-38f8-43a4-a397-9a3de7409c02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/f78d6402-38f8-43a4-a397-9a3de7409c02.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/f8e565a2-77f1-48c6-befd-e0aef050c2ff.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/f8e565a2-77f1-48c6-befd-e0aef050c2ff.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/fe506da1-ffac-48e1-9868-eeaa0c257670.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/fe506da1-ffac-48e1-9868-eeaa0c257670.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/fe78d88b-d9bb-4d84-90d8-c314f796121f.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/fe78d88b-d9bb-4d84-90d8-c314f796121f.jpg -------------------------------------------------------------------------------- /WebAPI/wwwroot/Images/ff554a87-622c-4ab0-b4e7-c34683b5523d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duygu98/ReCapProjectS/HEAD/WebAPI/wwwroot/Images/ff554a87-622c-4ab0-b4e7-c34683b5523d.jpg -------------------------------------------------------------------------------- /Console/Console.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Core/Entities/IDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities 6 | { 7 | public interface IDto 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Core/Entities/IEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities 6 | { 7 | public interface IEntity 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /WebAPI/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/LogDetailWithException.cs: -------------------------------------------------------------------------------- 1 | namespace Core.CrossCuttingConcerns.Logging 2 | { 3 | public class LogDetailWithException : LogDetail 4 | { 5 | public string ExceptionMessage { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /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 | } 10 | -------------------------------------------------------------------------------- /Core/Utilities/IoC/ICoreModule.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace Core.Utilities.IoC 4 | { 5 | public interface ICoreModule 6 | { 7 | void Load(IServiceCollection serviceCollection); 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Entities/DTOs/UserForLoginDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | 3 | namespace Entities.DTOs 4 | { 5 | public class UserForLoginDto : IDto 6 | { 7 | public string Email { get; set; } 8 | public string Password { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Core/Utilities/Results/IDataResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public interface IDataResult : IResult 8 | { 9 | T Data { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Core/Utilities/Security/JWT/AccessToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core.Utilities.Security.JWT 4 | { 5 | public class AccessToken 6 | { 7 | public string Token { get; set; } 8 | public DateTime Expiration { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfEntityRepositoryBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DataAccess.Concrete.EntityFramework 6 | { 7 | public class EfEntityRepositoryBase 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/LogParameter.cs: -------------------------------------------------------------------------------- 1 | namespace Core.CrossCuttingConcerns.Logging 2 | { 3 | public class LogParameter 4 | { 5 | public string Name { get; set; } 6 | public object Value { get; set; } 7 | public string Type { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /Core/Utilities/Results/IResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public interface IResult 8 | { 9 | bool Success { get; } 10 | string Message { get; } 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Abstack/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.Abstack 8 | { 9 | public interface IBrandDal:IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DataAccess/Abstack/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.Abstack 8 | { 9 | public interface IColorDal : IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DataAccess/Abstack/ICarImagesDal .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.Abstack 8 | { 9 | public interface ICarImagesDal : IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DataAccess/Abstack/IFakeCardDal.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.Abstack 8 | { 9 | public interface IFakeCardDal : IEntityRepository 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Core/Utilities/Security/JWT/ITokenHelper.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using System.Collections.Generic; 3 | 4 | namespace Core.Utilities.Security.JWT 5 | { 6 | public interface ITokenHelper 7 | { 8 | AccessToken CreateToken(User user, List operationClaims); 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/LogDetail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.CrossCuttingConcerns.Logging 6 | { 7 | public class LogDetail 8 | { 9 | public string MethodName { get; set; } 10 | public List LogParameters { get; set; } 11 | 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/Loggers/FileLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.CrossCuttingConcerns.Logging.Log4Net.Loggers 6 | { 7 | public class FileLogger : LoggerServiceBase 8 | { 9 | public FileLogger() : base("JsonFileLogger") 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/Loggers/DatabaseLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.CrossCuttingConcerns.Logging.Log4Net.Loggers 6 | { 7 | public class DatabaseLogger : LoggerServiceBase 8 | { 9 | public DatabaseLogger() : base("DatabaseLogger") 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/UserOperationClaim.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Entities.Concrete 6 | { 7 | public class UserOperationClaim : IEntity 8 | { 9 | public int Id { get; set; } 10 | public int UserId { get; set; } 11 | public int OperationClaimId { get; set; } 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Core/Utilities/Messages/AspectMessages.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Messages 6 | { 7 | public static class AspectMessages 8 | { 9 | public static string WrongValidationType = "Yanlış doğrulama türü"; 10 | public static string WrongLoggerType = "Yanlış kaydedici türü"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /DataAccess/Abstack/IUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess; 2 | using Core.Entities.Concrete; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Abstack 9 | { 10 | 11 | public interface IUserDal : IEntityRepository 12 | { 13 | List GetClaims(User user); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfFakeCardDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstack; 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 EfFakeCardDal : EfEntityRepositoryBase, IFakeCardDal 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCarImagesDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstack; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework 9 | { 10 | public class EfCarImageDal : EfEntityRepositoryBase, ICarImagesDal 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Core/Utilities/Results/ErrorResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class ErrorResult : Result 8 | { 9 | public ErrorResult(string message) : base(false, message) 10 | { 11 | 12 | } 13 | public ErrorResult() : base(false) 14 | { 15 | 16 | 17 | } 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 Id { get; set; } 11 | public int CarId { get; set; } 12 | public string ImagePath { get; set; } 13 | public DateTime? ImageDate { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Core/Utilities/Results/SuccessResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class SuccessResult : Result 8 | { 9 | public SuccessResult(string message) : base(true, message) 10 | { 11 | 12 | } 13 | public SuccessResult() : base(true) 14 | { 15 | 16 | 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Business/Abstack/IUserService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using Entities.Concrete; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Business.Abstack 9 | { 10 | public interface IUserService 11 | { 12 | List GetClaims(User user); 13 | void Add(User user); 14 | User GetByMail(string email); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /WebAPI/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "TokenOptions": { 3 | "Audience": "engin@engin.com", 4 | "Issuer": "engin@engin.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 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Encrypiton/SigningCredentialsHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.IdentityModel.Tokens; 2 | 3 | namespace Core.Utilities.Security.Encrypiton 4 | { 5 | public class SigningCredentialsHelper 6 | { 7 | public static SigningCredentials CreateSigningCredentials(SecurityKey security) 8 | { 9 | return new SigningCredentials(security, SecurityAlgorithms.HmacSha512Signature); 10 | 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DataAccess/Abstack/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.Abstack 10 | { 11 | public interface IRentalDal : IEntityRepository 12 | { 13 | List GetRentalDetails(Expression> filter = null); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ConsolePrj/ConsolePrj.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /DataAccess/Abstack/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.Abstack 10 | { 11 | public interface ICustomerDal : IEntityRepository 12 | { 13 | List GetCustomerDetails(Expression> filter = null); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/CarImageValidator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Entities.Concrete; 5 | using FluentValidation; 6 | 7 | namespace Business.ValidationRules.FluentValidation 8 | { 9 | public class CarImageValidator : AbstractValidator 10 | { 11 | public CarImageValidator() 12 | { 13 | RuleFor(c => c.CarId).NotEmpty(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Core/Utilities/Security/Encrypiton/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.Encrypiton 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 | } 17 | -------------------------------------------------------------------------------- /DataAccess/DataAccess.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfBrandDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstack; 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 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfColorDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstack; 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 | -------------------------------------------------------------------------------- /Business/Abstack/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.Abstack 8 | { 9 | public interface IColorService 10 | { 11 | IResult Add(Color color); 12 | IResult Delete(Color color); 13 | IResult Update(Color color); 14 | IDataResult> GetAll(); 15 | IDataResult> GetCarsByColorId(int id); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Business/Abstack/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.Abstack 8 | { 9 | public interface IBrandService 10 | { 11 | IResult Add(Brand brand); 12 | IResult Delete(Brand brand); 13 | IResult Update(Brand brand); 14 | IDataResult> GetAll(); 15 | IDataResult> GetCarsByBrandId(int id); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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 | } 18 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/BrandValidator.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using FluentValidation; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Business.ValidationRules.FluentValidation 8 | { 9 | public class BrandValidator : AbstractValidator 10 | { 11 | public BrandValidator() 12 | { 13 | 14 | RuleFor(b => b.BrandName).NotEmpty(); 15 | RuleFor(b => b.BrandName).MinimumLength(2); 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/ColorValidator.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 ColorValidator : AbstractValidator 10 | { 11 | 12 | public ColorValidator() 13 | { 14 | RuleFor(c => c.ColorName).NotEmpty(); 15 | RuleFor(c => c.ColorName).MinimumLength(2); 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Entities/Concrete/FakeCard.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 FakeCard : IEntity 9 | { 10 | public int Id { get; set; } 11 | public string NameOnTheCard { get; set; } 12 | public string CardNumber { get; set; } 13 | public string CardCvv { get; set; } 14 | public string ExpirationDate { get; set; } 15 | public decimal MoneyInTheCard { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Core/Utilities/Results/Result.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class Result : IResult 8 | { 9 | public Result(bool succsess, string message) : this(succsess) 10 | { 11 | Message = message; 12 | } 13 | public Result(bool succsess) 14 | { 15 | Success = succsess; 16 | } 17 | 18 | public bool Success { get; } 19 | public string Message { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /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 | public DataResult(T data, bool success) : base(success) 14 | { 15 | Data = data; 16 | } 17 | public T Data { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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 Id { 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 int DailyPrice { get; set; } 16 | public string Description{ get; set; } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 int UserId { get; set; } 12 | public string CompanyName { get; set; } 13 | public string FirstName { get; set; } 14 | public string LastName { get; set; } 15 | public string Email { get; set; } 16 | public bool Status { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Business/ValidationRules/FluentValidation/RentalValidator.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 RentalValidator : AbstractValidator 10 | { 11 | public RentalValidator() 12 | { 13 | RuleFor(ren => ren.CustomerId).NotEmpty(); 14 | RuleFor(ren => ren.CarId).NotEmpty(); 15 | RuleFor(ren => ren.RentDate).NotEmpty(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/SerializableLogEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using log4net.Core; 5 | 6 | namespace Core.CrossCuttingConcerns.Logging.Log4Net 7 | { 8 | [Serializable] 9 | public class SerializableLogEvent 10 | { 11 | private LoggingEvent _loggingEvent; 12 | 13 | public SerializableLogEvent(LoggingEvent loggingEvent) 14 | { 15 | _loggingEvent = loggingEvent; 16 | } 17 | 18 | public object Message => _loggingEvent.MessageObject; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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 | public interface IEntityRepository where T : class, IEntity, new() 10 | { 11 | List GetAll(Expression> filter = null); 12 | T Get(Expression> filter); 13 | void Add(T entity); 14 | void Update(T entity); 15 | void Delete(T entity); 16 | List GetById(int entity); 17 | 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Core/Entities/Concrete/User.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Core.Entities; 5 | 6 | namespace Core.Entities.Concrete 7 | { 8 | public class User : IEntity 9 | { 10 | public int UserId { get; set; } 11 | public string FirstName { get; set; } 12 | public string LastName { get; set; } 13 | public string Email { get; set; } 14 | public byte[] PasswordHash { get; set; } 15 | public byte[] PasswordSalt { get; set; } 16 | public bool Status { get; set; } 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /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 | } 24 | -------------------------------------------------------------------------------- /Core/Utilities/Interceptors/MethodInterceptionBaseAttribute.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Core.Utilities.Interceptors 7 | { 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] 9 | public abstract class MethodInterceptionBaseAttribute : Attribute, IInterceptor 10 | { 11 | public int Priority { get; set; } 12 | 13 | public virtual void Intercept(IInvocation invocation) 14 | { 15 | 16 | } 17 | } 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Business/Abstack/IAuthService.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Utilities.Results; 3 | using Core.Utilities.Security.JWT; 4 | using Entities.DTOs; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace Business.Abstract 10 | { 11 | public interface IAuthService 12 | { 13 | IDataResult Register(UserForRegisterDto userForRegisterDto, string password); 14 | IDataResult Login(UserForLoginDto userForLoginDto); 15 | IResult UserExists(string email); 16 | IDataResult CreateAccessToken(User user); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Business/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.ModelYear).NotEmpty(); 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DataAccess/Abstack/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.Abstack 10 | { 11 | public interface ICarDal : IEntityRepository 12 | { 13 | List GetCarDetails(Expression> filter = null); 14 | List GetCarsDetailsByBrandId(int id); 15 | List GetCarsDetailsByColorId(int id); 16 | List GetCarsByFilter(int colorId, int brandId); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Business/Abstack/ICarImageService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Business.Abstract 9 | { 10 | public interface ICarImageService 11 | { 12 | IDataResult> GetAll(); 13 | IDataResult GetById(int id); 14 | IDataResult> GetByCarId(int id); 15 | IResult Add(IFormFile file, CarImage carImage); 16 | IResult Update(IFormFile file, CarImage carImage); 17 | IResult Delete(CarImage carImage); 18 | } 19 | } -------------------------------------------------------------------------------- /Business/Abstack/IFakeCardService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Core.Utilities.Results; 5 | using Entities.Concrete; 6 | 7 | namespace Business.Abstack 8 | { 9 | public interface IFakeCardService 10 | { 11 | IDataResult> GetByCardNumber(string cardNumber); 12 | IDataResult> GetAll(); 13 | IDataResult GetById(int cardId); 14 | IResult IsCardExist(FakeCard fakeCard); 15 | IResult Add(FakeCard fakeCard); 16 | IResult Delete(FakeCard fakeCard); 17 | IResult Update(FakeCard fakeCard); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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 | public ErrorDataResult(T data) : base(data, false) 13 | { 14 | } 15 | public ErrorDataResult(string message) : base(default, false, message) 16 | { 17 | } 18 | public ErrorDataResult() : base(default, false) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Core/Extensions/ErrorDetails.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation.Results; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Core.Extensions 8 | { 9 | public class ErrorDetails 10 | { 11 | public string Message { get; set; } 12 | public int StatusCode { get; set; } 13 | 14 | public override string ToString() 15 | { 16 | return JsonConvert.SerializeObject(this); 17 | } 18 | } 19 | 20 | public class ValidationErrorDetails : ErrorDetails 21 | { 22 | public IEnumerable Errors { get; set; } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Core/Utilities/Results/SuccessDataResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Core.Utilities.Results 6 | { 7 | public class SuccessDataResult : DataResult 8 | { 9 | public SuccessDataResult(T data, string message) : base(data, true, message) 10 | { 11 | } 12 | public SuccessDataResult(T data) : base(data, true) 13 | { 14 | } 15 | public SuccessDataResult(string message) : base(default, true, message) 16 | { 17 | } 18 | public SuccessDataResult() : base(default, true) 19 | { 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | 14 | var result = validator.Validate(context); 15 | if (!result.IsValid) 16 | { 17 | throw new ValidationException(result.Errors); 18 | 19 | } 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | namespace Core.Extensions 7 | { 8 | public static class ServiceCollectionExtensions 9 | { 10 | public static IServiceCollection AddDependencyResolvers(this IServiceCollection serviceCollection, ICoreModule[] modules) 11 | { 12 | foreach (var module in modules) 13 | { 14 | module.Load(serviceCollection); 15 | } 16 | return ServiceTool.Create(serviceCollection); 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Business/Abstack/ICustomerService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Business.Abstack 9 | { 10 | public interface ICustomerService 11 | { 12 | IDataResult> GetAll(); 13 | IDataResult> GetByCustomerId(int id); 14 | IDataResult> GetCustomerDetails(); 15 | IDataResult> GetCustomerDetailById(int customerId); 16 | IResult Add(Customer customer); 17 | IResult Update(Customer customer); 18 | IResult Delete(Customer customer); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Entities/DTOs/CarDetailDto.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using Entities.Concrete; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Entities.DTOs 8 | { 9 | public class CarDetailDto :IDto 10 | { 11 | public int CarId { get; set; } 12 | public int BrandId { get; set; } 13 | public int ColorId { get; set; } 14 | public string BrandName { get; set; } 15 | public string ModelYear { get; set; } 16 | public string ColorName { get; set; } 17 | public string CarName { get; set; } 18 | public decimal DailyPrice { get; set; } 19 | public string Descriptions { get; set; } 20 | public List CarImages { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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.Text; 9 | namespace Core.DependencyResolvers 10 | { 11 | public class CoreModule : ICoreModule 12 | { 13 | public void Load(IServiceCollection serviceCollection) 14 | { 15 | serviceCollection.AddMemoryCache(); 16 | serviceCollection.AddSingleton(); 17 | serviceCollection.AddSingleton(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/Layouts/JsonLayout.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | using log4net.Core; 6 | using log4net.Layout; 7 | using Newtonsoft.Json; 8 | 9 | namespace Core.CrossCuttingConcerns.Logging.Log4Net.Layouts 10 | { 11 | public class JsonLayout : LayoutSkeleton 12 | { 13 | public override void ActivateOptions() 14 | { 15 | 16 | } 17 | 18 | public override void Format(TextWriter writer, LoggingEvent loggingEvent) 19 | { 20 | var logEvent = new SerializableLogEvent(loggingEvent); 21 | var json = JsonConvert.SerializeObject(logEvent, Formatting.Indented); 22 | writer.WriteLine(json); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 BrandName { get; set; } 13 | public string ColorName { get; set; } 14 | public string FirstName { get; set; } 15 | public string LastName { get; set; } 16 | public string CompanyName { get; set; } 17 | public string CarModelYear { get; set; } 18 | public decimal CarDailyPrice { get; set; } 19 | public string CarDescription { get; set; } 20 | public DateTime RentDate { get; set; } 21 | public DateTime? ReturnDate { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Transaction/TransactionScopeAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.Utilities.Interceptors; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using System.Transactions; 7 | 8 | namespace Core.Aspects.Autofac.Transaction 9 | { 10 | public class TransactionScopeAspect : MethodInterception 11 | { 12 | public override void Intercept(IInvocation invocation) 13 | { 14 | using (TransactionScope transactionScope = new TransactionScope()) 15 | { 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 | -------------------------------------------------------------------------------- /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:64980", 8 | "sslPort": 44304 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 | -------------------------------------------------------------------------------- /Business/Abstack/IRentalService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Business.Abstack 9 | { 10 | public interface IRentalService 11 | { 12 | IDataResult> GetAll(); 13 | IDataResult> GetByRentalId(int id); 14 | IDataResult> GetByCarId(int id); 15 | IDataResult> GetByCustomerId(int id); 16 | IDataResult> GetByRentDate(DateTime first, DateTime last); 17 | IDataResult CheckReturnDate(int carId); 18 | IDataResult> GetRentalDetails(); 19 | IDataResult> GetRentalDetailsByCarId(int carId); 20 | IResult Add(Rental rental); 21 | IResult Update(Rental rental); 22 | IResult Delete(Rental rental); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Business/Concrete/UserManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Business.Constants; 3 | using Core.Entities.Concrete; 4 | using Core.Utilities.Results; 5 | using DataAccess.Abstack; 6 | using Entities.Concrete; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | 11 | namespace Business.Concrete 12 | { 13 | 14 | public class UserManager : IUserService 15 | { 16 | IUserDal _userDal; 17 | 18 | public UserManager(IUserDal userDal) 19 | { 20 | _userDal = userDal; 21 | } 22 | 23 | public List GetClaims(User user) 24 | { 25 | return _userDal.GetClaims(user); 26 | } 27 | 28 | public void Add(User user) 29 | { 30 | _userDal.Add(user); 31 | } 32 | 33 | public User GetByMail(string email) 34 | { 35 | return _userDal.Get(u => u.Email == email); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /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/Utilities/Interceptors/AspectInterceptorSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Reflection; 4 | using Castle.DynamicProxy; 5 | using Core.Aspects.Autofac.Exception; 6 | using Core.CrossCuttingConcerns.Logging.Log4Net.Loggers; 7 | 8 | namespace Core.Utilities.Interceptors 9 | { 10 | public class AspectInterceptorSelector : IInterceptorSelector 11 | { 12 | public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IInterceptor[] interceptors) 13 | { 14 | var classAttributes = type.GetCustomAttributes 15 | (true).ToList(); 16 | var methodAttributes = type.GetMethod(method.Name) 17 | .GetCustomAttributes(true); 18 | classAttributes.AddRange(methodAttributes); 19 | classAttributes.Add(new ExceptionLogAspect(typeof(FileLogger))); 20 | 21 | return classAttributes.OrderBy(x => x.Priority).ToArray(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfUserDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using Core.Entities.Concrete; 3 | using DataAccess.Abstack; 4 | using Entities.Concrete; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using System.Linq; 9 | 10 | namespace DataAccess.Concrete.EntityFramework 11 | { 12 | public class EfUserDal : EfEntityRepositoryBase, IUserDal 13 | { 14 | public List GetClaims(User user) 15 | { 16 | using (var context = new CarDbContext()) 17 | { 18 | var result = from operationClaim in context.OperationClaims 19 | join userOperationClaim in context.UserOperationClaims 20 | on operationClaim.Id equals userOperationClaim.OperationClaimId 21 | where userOperationClaim.UserId == user.UserId 22 | select new OperationClaim { Id = operationClaim.Id, Name = operationClaim.Name }; 23 | return result.ToList(); 24 | 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/CarDbContext.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Entities.Concrete; 3 | using Microsoft.EntityFrameworkCore; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace DataAccess.Concrete.EntityFramework 9 | { 10 | public class CarDbContext : DbContext 11 | { 12 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 13 | { 14 | optionsBuilder.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=DbCars;Trusted_Connection=true"); 15 | } 16 | 17 | public DbSet Cars { get; set; } 18 | public DbSet Colors { get; set; } 19 | public DbSet Brands { get; set; } 20 | public DbSet Customers { get; set; } 21 | public DbSet Users { get; set; } 22 | public DbSet Rentals { get; set; } 23 | public DbSet OperationClaims { get; set; } 24 | public DbSet CarImages { get; set; } 25 | public DbSet UserOperationClaims { get; set; } 26 | public DbSet FakeCards { get; set; } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /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 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Perfromanca/PerformanceAspect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Text; 5 | using Castle.DynamicProxy; 6 | using Core.Utilities.Interceptors; 7 | using Core.Utilities.IoC; 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 | _stopwatch.Reset(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /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/Aspects/Autofac/Validation/ValidationAspect.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | using Core.CrossCuttingConcerns.Validation; 3 | using Core.Utilities.Interceptors; 4 | using FluentValidation; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | 10 | namespace Core.Aspects.Autofac.Validation 11 | { 12 | public class ValidationAspect : MethodInterception 13 | { 14 | private Type _validatorType; 15 | public ValidationAspect(Type validatorType) 16 | { 17 | if (!typeof(IValidator).IsAssignableFrom(validatorType)) 18 | { 19 | throw new System.Exception("Bu bir doğrulama sınıfı değil"); 20 | } 21 | 22 | _validatorType = validatorType; 23 | } 24 | protected override void OnBefore(IInvocation invocation) 25 | { 26 | var validator = (IValidator)Activator.CreateInstance(_validatorType); 27 | var entityType = _validatorType.BaseType.GetGenericArguments()[0]; 28 | var entities = invocation.Arguments.Where(t => t.GetType() == entityType); 29 | foreach (var entity in entities) 30 | { 31 | ValidationTool.Validate(validator, entity); 32 | } 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Business/Abstack/ICarService.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.Results; 2 | using Entities.Concrete; 3 | using Entities.DTOs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Business.Abstack 9 | { 10 | public interface ICarService 11 | { 12 | 13 | IResult Add(Car car); 14 | IResult Delete(Car car); 15 | IResult Update(Car car); 16 | IDataResult> GetAll(); 17 | IDataResult> GetCarsByBrandId(int id); 18 | IDataResult> GetCarsByColorId(int id); 19 | IDataResult> GetCarDetails(); 20 | 21 | 22 | IDataResult> GetCarDetailsById(int carId); 23 | IDataResult> GetCarDetailsByBrandAndColorId(int brandId, int colorId); 24 | 25 | 26 | IDataResult> GetCarsByFilter(int brandId, int colorId); 27 | IDataResult> GetCarsByBrandIdList(int brandId); 28 | IDataResult> GetCarsByColorIdList(int colorId); 29 | IDataResult> GetCarDetailsByCarId(int carId); 30 | 31 | IDataResult> GetCarsDetailsByColorId(int id); 32 | IDataResult> GetCarsDetailsByBrandId(int id); 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Business/BusinessAspect/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.BusinessAspect.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 | -------------------------------------------------------------------------------- /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/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 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /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 | if (_cacheManager.IsAdd(key)) 30 | { 31 | invocation.ReturnValue = _cacheManager.Get(key); 32 | return; 33 | } 34 | invocation.Proceed(); 35 | _cacheManager.Add(key, invocation.ReturnValue, _duration); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Business/Concrete/ColorManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Business.Constants; 3 | using Business.ValidationRules.FluentValidation; 4 | using Core.Aspects.Autofac.Validation; 5 | using Core.Utilities.Results; 6 | using DataAccess.Abstack; 7 | using Entities.Concrete; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | 12 | namespace Business.Concrete 13 | { 14 | public class ColorManager : IColorService 15 | { 16 | IColorDal _color; 17 | public ColorManager(IColorDal color) 18 | { 19 | _color = color; 20 | } 21 | 22 | [ValidationAspect(typeof(ColorValidator ))] 23 | public IResult Add(Color color) 24 | { 25 | _color.Add(color); 26 | return new SuccessResult(Messages.ColorAdded); 27 | } 28 | public IResult Delete(Color color) 29 | { 30 | _color.Delete(color); 31 | return new SuccessResult(); 32 | } 33 | public IDataResult> GetAll() 34 | { 35 | return new SuccessDataResult>(_color.GetAll(), Messages.ColorListed); 36 | } 37 | public IDataResult> GetCarsByColorId(int id) 38 | { 39 | return new SuccessDataResult>(_color.GetAll(c => c.ColorId == id)); 40 | 41 | } 42 | public IResult Update(Color color) 43 | { 44 | _color.Update(color); 45 | return new SuccessResult(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Business/Concrete/BrandManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Business.Constants; 3 | using Business.ValidationRules.FluentValidation; 4 | using Core.Aspects.Autofac.Validation; 5 | using Core.Utilities.Results; 6 | using DataAccess.Abstack; 7 | using Entities.Concrete; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | 12 | namespace Business.Concrete 13 | { 14 | public class BrandManager : IBrandService 15 | { 16 | IBrandDal _brand; 17 | public BrandManager(IBrandDal brand) 18 | { 19 | _brand = brand; 20 | } 21 | [ValidationAspect(typeof(BrandValidator))] 22 | public IResult Add(Brand brand) 23 | { 24 | _brand.Add(brand); 25 | return new SuccessResult(Messages.BrandAdded); 26 | } 27 | public IResult Delete(Brand brand) 28 | { 29 | _brand.Delete(brand); 30 | return new SuccessResult(); 31 | } 32 | public IDataResult> GetAll() 33 | { 34 | return new SuccessDataResult>(_brand.GetAll(), Messages.BrandListed); 35 | } 36 | public IDataResult> GetCarsByBrandId(int id) 37 | { 38 | return new SuccessDataResult>(_brand.GetAll(c => c.BrandId == id)); 39 | 40 | } 41 | 42 | public IResult Update(Brand brand) 43 | { 44 | _brand.Update(brand); 45 | return new SuccessResult(); 46 | 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCustomerDal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Text; 6 | using Core.DataAccess.EntityFramework; 7 | using DataAccess.Abstack; 8 | using Entities.Concrete; 9 | using Entities.DTOs; 10 | 11 | namespace DataAccess.Concrete.EntityFramework 12 | { 13 | public class EfCustomerDal: EfEntityRepositoryBase, ICustomerDal 14 | { 15 | public List GetCustomerDetails(Expression> filter = null) 16 | { 17 | using (CarDbContext context =new CarDbContext()) 18 | { 19 | var result = from ct in filter == null ? context.Customers : context.Customers.Where(filter) 20 | join us in context.Users 21 | on ct.UserId equals us.UserId 22 | select new CustomerDetailDto 23 | { 24 | CustomerId = ct.CustomerId, 25 | UserId = us.UserId, 26 | CompanyName = ct.CompanyName, 27 | Email = us.Email, 28 | FirstName = us.FirstName, 29 | LastName = us.LastName, 30 | Status = us.Status 31 | }; 32 | return result.ToList(); 33 | 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Logging/LogAspect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Castle.DynamicProxy; 5 | using Core.CrossCuttingConcerns.Logging; 6 | using Core.CrossCuttingConcerns.Logging.Log4Net; 7 | using Core.Utilities.Interceptors; 8 | using Core.Utilities.Messages; 9 | 10 | namespace Core.Aspects.Autofac.Logging 11 | { 12 | public class LogAspect : MethodInterception 13 | { 14 | private LoggerServiceBase _loggerServiceBase; 15 | 16 | public LogAspect(Type loggerService) 17 | { 18 | if (loggerService.BaseType != typeof(LoggerServiceBase)) 19 | { 20 | throw new System.Exception(AspectMessages.WrongLoggerType); 21 | } 22 | 23 | _loggerServiceBase = (LoggerServiceBase)Activator.CreateInstance(loggerService); 24 | } 25 | 26 | protected override void OnBefore(IInvocation invocation) 27 | { 28 | _loggerServiceBase.Info(GetLogDetail(invocation)); 29 | } 30 | 31 | private LogDetail GetLogDetail(IInvocation invocation) 32 | { 33 | var logParameters = new List(); 34 | for (int i = 0; i < invocation.Arguments.Length; i++) 35 | { 36 | logParameters.Add(new LogParameter 37 | { 38 | Name = invocation.GetConcreteMethod().GetParameters()[i].Name, 39 | Value = invocation.Arguments[i], 40 | Type = invocation.Arguments[i].GetType().Name 41 | }); 42 | } 43 | 44 | var logDetail = new LogDetail 45 | { 46 | MethodName = invocation.Method.Name, 47 | LogParameters = logParameters 48 | }; 49 | 50 | return logDetail; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /WebAPI/Controllers/UsersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Entities.DTOs; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class AuthController : 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.Data); 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.Data); 55 | } 56 | 57 | return BadRequest(result.Message); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Business/Concrete/FakeCardManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Business.Abstack; 5 | using Business.Abstract; 6 | using Core.Utilities.Results; 7 | using DataAccess.Abstack; 8 | using Entities.Concrete; 9 | 10 | namespace Business.Concrete 11 | { 12 | public class FakeCardManager : IFakeCardService 13 | { 14 | IFakeCardDal _fakeCardDal; 15 | 16 | public FakeCardManager(IFakeCardDal fakeCardDal) 17 | { 18 | _fakeCardDal = fakeCardDal; 19 | } 20 | 21 | public IDataResult> GetByCardNumber(string cardNumber) 22 | { 23 | return new SuccessDataResult>(_fakeCardDal.GetAll(c => c.CardNumber == cardNumber)); 24 | } 25 | 26 | public IDataResult> GetAll() 27 | { 28 | return new SuccessDataResult>(_fakeCardDal.GetAll()); 29 | } 30 | 31 | public IDataResult GetById(int carId) 32 | { 33 | return new SuccessDataResult(_fakeCardDal.Get(c => c.Id == carId)); 34 | } 35 | 36 | public IResult IsCardExist(FakeCard fakeCard) 37 | { 38 | var result = _fakeCardDal.Get(c => c.NameOnTheCard == fakeCard.NameOnTheCard && c.CardNumber == fakeCard.CardNumber && c.CardCvv == fakeCard.CardCvv); 39 | if (result == null) 40 | { 41 | return new ErrorResult(); 42 | } 43 | return new SuccessResult(); 44 | } 45 | 46 | public IResult Add(FakeCard fakeCard) 47 | { 48 | _fakeCardDal.Add(fakeCard); 49 | return new SuccessResult(); 50 | } 51 | 52 | public IResult Delete(FakeCard fakeCard) 53 | { 54 | _fakeCardDal.Delete(fakeCard); 55 | return new SuccessResult(); 56 | } 57 | 58 | public IResult Update(FakeCard fakeCard) 59 | { 60 | _fakeCardDal.Update(fakeCard); 61 | return new SuccessResult(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Core/Aspects/Autofac/Exception/ExceptionLogAspect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Castle.DynamicProxy; 5 | using Core.CrossCuttingConcerns.Logging; 6 | using Core.CrossCuttingConcerns.Logging.Log4Net; 7 | using Core.Utilities.Interceptors; 8 | using Core.Utilities.Messages; 9 | 10 | namespace Core.Aspects.Autofac.Exception 11 | { 12 | public class ExceptionLogAspect : MethodInterception 13 | { 14 | private LoggerServiceBase _loggerServiceBase; 15 | 16 | public ExceptionLogAspect(Type loggerService) 17 | { 18 | if (loggerService.BaseType != typeof(LoggerServiceBase)) 19 | { 20 | throw new System.Exception(AspectMessages.WrongLoggerType); 21 | } 22 | 23 | _loggerServiceBase = (LoggerServiceBase)Activator.CreateInstance(loggerService); 24 | } 25 | protected override void OnException(IInvocation invocation, System.Exception e) 26 | { 27 | LogDetailWithException logDetailWithException = GetLogDetail(invocation); 28 | logDetailWithException.ExceptionMessage = e.Message; 29 | _loggerServiceBase.Error(logDetailWithException); 30 | } 31 | 32 | private LogDetailWithException GetLogDetail(IInvocation invocation) 33 | { 34 | var logParameters = new List(); 35 | 36 | for (int i = 0; i < invocation.Arguments.Length; i++) 37 | { 38 | logParameters.Add(new LogParameter 39 | { 40 | Name = invocation.GetConcreteMethod().GetParameters()[i].Name, 41 | Value = invocation.Arguments[i], 42 | Type = invocation.Arguments[i].GetType().Name 43 | }); 44 | } 45 | 46 | var logDetailWithException = new LogDetailWithException 47 | { 48 | MethodName = invocation.Method.Name, 49 | LogParameters = logParameters 50 | }; 51 | 52 | return logDetailWithException; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Logging/Log4Net/LoggerServiceBase.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Xml; 8 | using log4net.Repository; 9 | 10 | namespace Core.CrossCuttingConcerns.Logging.Log4Net 11 | { 12 | public class LoggerServiceBase 13 | { 14 | private ILog _log; 15 | public LoggerServiceBase(string name) 16 | { 17 | XmlDocument xmlDocument = new XmlDocument(); 18 | // xmlDocument.Load(File.OpenRead("log4net.config")); 19 | 20 | ILoggerRepository loggerRepository = LogManager.CreateRepository(Assembly.GetEntryAssembly(), 21 | typeof(log4net.Repository.Hierarchy.Hierarchy)); 22 | log4net.Config.XmlConfigurator.Configure(loggerRepository, xmlDocument["log4net"]); 23 | 24 | _log = LogManager.GetLogger(loggerRepository.Name, name); 25 | 26 | 27 | } 28 | 29 | public bool IsInfoEnabled => _log.IsInfoEnabled; 30 | public bool IsDebugEnabled => _log.IsDebugEnabled; 31 | public bool IsWarnEnabled => _log.IsWarnEnabled; 32 | public bool IsFatalEnabled => _log.IsFatalEnabled; 33 | public bool IsErrorEnabled => _log.IsErrorEnabled; 34 | 35 | public void Info(object logMessage) 36 | { 37 | if (IsInfoEnabled) 38 | _log.Info(logMessage); 39 | } 40 | 41 | public void Debug(object logMessage) 42 | { 43 | if (IsDebugEnabled) 44 | _log.Debug(logMessage); 45 | } 46 | 47 | public void Warn(object logMessage) 48 | { 49 | if (IsWarnEnabled) 50 | _log.Warn(logMessage); 51 | } 52 | 53 | public void Fatal(object logMessage) 54 | { 55 | if (IsFatalEnabled) 56 | _log.Fatal(logMessage); 57 | } 58 | 59 | public void Error(object logMessage) 60 | { 61 | if (IsErrorEnabled) 62 | _log.Error(logMessage); 63 | } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Business/Concrete/CustomerManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Business.Constants; 3 | using Core.Utilities.Results; 4 | using DataAccess.Abstack; 5 | using Entities.Concrete; 6 | using Entities.DTOs; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | 11 | namespace Business.Concrete 12 | { 13 | public class CustomerManager : ICustomerService 14 | { 15 | 16 | ICustomerDal _customerDal; 17 | 18 | public CustomerManager(ICustomerDal customerDal) 19 | { 20 | _customerDal = customerDal; 21 | } 22 | 23 | public IDataResult> GetAll() 24 | { 25 | return new SuccessDataResult>(_customerDal.GetAll(), Messages.CustomerListed); 26 | } 27 | 28 | public IDataResult> GetByCustomerId(int id) 29 | { 30 | return new SuccessDataResult>(_customerDal.GetAll(c => c.CustomerId == id), Messages.CustomerListed); 31 | } 32 | 33 | public IDataResult> GetCustomerDetails() 34 | { 35 | return new SuccessDataResult>(_customerDal.GetCustomerDetails(), Messages.CustomerListed); 36 | } 37 | 38 | public IDataResult> GetCustomerDetailById(int customerId) 39 | { 40 | return new SuccessDataResult>(_customerDal.GetCustomerDetails(c => c.CustomerId == customerId), Messages.CustomerListed); 41 | } 42 | 43 | public IResult Add(Customer customer) 44 | { 45 | _customerDal.Add(customer); 46 | return new SuccessResult(Messages.CustomerAdded); 47 | } 48 | 49 | public IResult Update(Customer customer) 50 | { 51 | _customerDal.Update(customer); 52 | return new SuccessResult(Messages.CustomerUpdated); 53 | } 54 | 55 | public IResult Delete(Customer customer) 56 | { 57 | _customerDal.Delete(customer); 58 | return new SuccessResult(Messages.CustomerUpdated); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /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 | //Tüm kodlarını try catch içine alıyor. 13 | public class ExceptionMiddleware 14 | { 15 | private RequestDelegate _next; 16 | 17 | public ExceptionMiddleware(RequestDelegate next) 18 | { 19 | _next = next; 20 | } 21 | 22 | public async Task InvokeAsync(HttpContext httpContext) 23 | { 24 | try 25 | { 26 | await _next(httpContext); 27 | } 28 | catch (Exception e) 29 | { 30 | await HandleExceptionAsync(httpContext, e); 31 | } 32 | } 33 | 34 | private Task HandleExceptionAsync(HttpContext httpContext, Exception e) 35 | { 36 | httpContext.Response.ContentType = "application/json"; 37 | httpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; 38 | 39 | string message = "Internal Server Error"; 40 | IEnumerable errors; 41 | 42 | if (e.GetType() == typeof(ValidationException)) 43 | { 44 | message = e.Message; 45 | errors = ((ValidationException)e).Errors; 46 | httpContext.Response.StatusCode = 400; 47 | 48 | //validation 49 | return httpContext.Response.WriteAsync(new ValidationErrorDetails 50 | { 51 | StatusCode = 400, 52 | Message = message, 53 | Errors = errors 54 | 55 | }.ToString()); 56 | } 57 | //sistemsel hata 58 | return httpContext.Response.WriteAsync(new ErrorDetails 59 | { 60 | StatusCode = httpContext.Response.StatusCode, 61 | Message = message 62 | }.ToString()); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfRentalDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstack; 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 (CarDbContext context = new CarDbContext()) 18 | { 19 | var result = from rt in filter == null ? context.Rentals : context.Rentals.Where(filter) 20 | join cr in context.Cars on rt.CarId equals cr.Id 21 | join cst in context.Customers on rt.CustomerId equals cst.CustomerId 22 | join usr in context.Users on cst.UserId equals usr.UserId 23 | join brd in context.Brands on cr.BrandId equals brd.BrandId 24 | join clr in context.Colors on cr.ColorId equals clr.ColorId 25 | select new RentalDetailDto 26 | { 27 | RentalId = rt.RentalId, 28 | CompanyName = cst.CompanyName, 29 | CarModelYear = cr.ModelYear, 30 | CarDailyPrice = cr.DailyPrice, 31 | CarDescription = cr.Description, 32 | CarId = rt.CarId, 33 | FirstName = usr.FirstName, 34 | LastName = usr.LastName, 35 | BrandName = brd.BrandName, 36 | ColorName = clr.ColorName, 37 | RentDate = rt.RentDate, 38 | ReturnDate = rt.ReturnDate 39 | }; 40 | return result.ToList(); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /WebAPI/Controllers/ColorsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 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 | public ColorsController(IColorService colorService) 18 | { 19 | _colorservice = colorService; 20 | } 21 | 22 | [HttpGet("getall")] 23 | public IActionResult Get() 24 | { 25 | var result = _colorservice.GetAll(); 26 | if (result.Success) 27 | { 28 | return Ok(result); 29 | } 30 | return BadRequest(result); 31 | } 32 | 33 | [HttpGet("getbycolorid")] 34 | public IActionResult GetCarsByColorId(int id) 35 | { 36 | var result = _colorservice.GetCarsByColorId(id); 37 | if (result.Success) 38 | { 39 | return Ok(result); 40 | } 41 | return BadRequest(result); 42 | } 43 | 44 | [HttpPost("add")] 45 | public IActionResult Add(Color color) 46 | { 47 | var result = _colorservice.Add(color); 48 | if (result.Success) 49 | { 50 | return Ok(result); 51 | } 52 | return BadRequest(result); 53 | } 54 | [HttpPost("delete")] 55 | public IActionResult Delete(Color color) 56 | { 57 | var result = _colorservice.Delete(color); 58 | if (result.Success) 59 | { 60 | return Ok(result); 61 | } 62 | return BadRequest(result); 63 | } 64 | [HttpPost("update")] 65 | public IActionResult Update(Color color) 66 | { 67 | var result = _colorservice.Update(color); 68 | if (result.Success) 69 | { 70 | return Ok(result); 71 | } 72 | return BadRequest(result); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Core/DataAccess/EntityFramework/EfEntityRepositoryBase.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using Microsoft.EntityFrameworkCore; 5 | using System.Text; 6 | using System.Linq.Expressions; 7 | using System.Linq; 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 | { 16 | public void Add(TEntity entity) 17 | { 18 | using (TContext context = new TContext()) 19 | { 20 | var addedEntity = context.Entry(entity); 21 | addedEntity.State = EntityState.Added; 22 | context.SaveChanges(); 23 | } 24 | } 25 | 26 | public void Delete(TEntity entity) 27 | { 28 | using (TContext context = new TContext()) 29 | { 30 | var deletedEntity = context.Entry(entity); 31 | deletedEntity.State = EntityState.Deleted; 32 | context.SaveChanges(); 33 | 34 | } 35 | } 36 | 37 | public TEntity Get(Expression> filter) 38 | { 39 | using (TContext context = new TContext()) 40 | { 41 | return context.Set().SingleOrDefault(filter); 42 | } 43 | } 44 | 45 | public List GetAll(Expression> filter = null) 46 | { 47 | using (TContext context = new TContext()) 48 | { 49 | return filter == null 50 | ? context.Set().ToList() 51 | : context.Set().Where(filter).ToList(); 52 | } 53 | } 54 | 55 | public List GetById(int entity) 56 | { 57 | throw new NotImplementedException(); 58 | } 59 | 60 | public void Update(TEntity entity) 61 | { 62 | using (TContext context = new TContext()) 63 | { 64 | var updatedEntity = context.Entry(entity); 65 | updatedEntity.State = EntityState.Modified; 66 | context.SaveChanges(); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /WebAPI/Controllers/BrandsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 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 | 28 | if (result.Success) 29 | { 30 | return Ok(result); 31 | } 32 | 33 | return BadRequest(result); 34 | } 35 | 36 | [HttpGet("getbyid")] 37 | public IActionResult GetById(int brandId) 38 | { 39 | var result = _brandService.GetCarsByBrandId(brandId); 40 | 41 | if (result.Success) 42 | { 43 | return Ok(result); 44 | } 45 | 46 | return BadRequest(result); 47 | } 48 | 49 | [HttpPost("add")] 50 | public IActionResult Add(Brand brand) 51 | { 52 | var result = _brandService.Add(brand); 53 | 54 | if (result.Success) 55 | { 56 | return Ok(result); 57 | } 58 | 59 | return BadRequest(result); 60 | } 61 | 62 | [HttpPost("update")] 63 | public IActionResult Update(Brand brand) 64 | { 65 | var result = _brandService.Update(brand); 66 | 67 | if (result.Success) 68 | { 69 | return Ok(result); 70 | } 71 | 72 | return BadRequest(result); 73 | } 74 | 75 | [HttpPost("delete")] 76 | public IActionResult Delete(Brand brand) 77 | { 78 | var result = _brandService.Delete(brand); 79 | 80 | if (result.Success) 81 | { 82 | return Ok(result); 83 | } 84 | 85 | return BadRequest(result); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /WebAPI/Controllers/RentalsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class RentalsController : ControllerBase 15 | { 16 | IRentalService _rentalService; 17 | 18 | public RentalsController(IRentalService rentalService) 19 | { 20 | _rentalService = rentalService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _rentalService.GetAll(); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | 32 | return BadRequest(result); 33 | } 34 | [HttpGet("getbyid")] 35 | public IActionResult GetById(int id) 36 | { 37 | var result = _rentalService.GetByCustomerId(id); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | 43 | return BadRequest(result); 44 | } 45 | 46 | [HttpGet("getrentaldetail")] 47 | public IActionResult GetCarDetail() 48 | { 49 | var result = _rentalService.GetRentalDetails(); 50 | if (result.Success) 51 | { 52 | return Ok(result); 53 | } 54 | 55 | return BadRequest(result); 56 | } 57 | 58 | [HttpGet("getrentaldetailbycarid")] 59 | public IActionResult GetRentalDetailsByCarId(int carId) 60 | { 61 | var result = _rentalService.GetRentalDetailsByCarId(carId); 62 | if (result.Success) 63 | { 64 | return Ok(result); 65 | } 66 | 67 | return BadRequest(result); 68 | } 69 | 70 | [HttpPost("add")] 71 | public IActionResult Add(Rental rental) 72 | { 73 | var result = _rentalService.Add(rental); 74 | if (result.Success) 75 | { 76 | return Ok(result); 77 | } 78 | 79 | return BadRequest(result); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CustomersController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Entities.Concrete; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace WebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class CustomersController : ControllerBase 15 | { 16 | ICustomerService _customerService; 17 | 18 | public CustomersController(ICustomerService customerService) 19 | { 20 | _customerService = customerService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _customerService.GetAll(); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | 32 | return BadRequest(result); 33 | } 34 | [HttpGet("getbyid")] 35 | public IActionResult GetById(int id) 36 | { 37 | var result = _customerService.GetByCustomerId(id); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | 43 | return BadRequest(result); 44 | } 45 | 46 | [HttpGet("getcustomerdetail")] 47 | public IActionResult GetCustomerDetail() 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("getcustomerdetailbycustomerid")] 59 | public IActionResult GetCustomerDetailById(int customerId) 60 | { 61 | var result = _customerService.GetCustomerDetailById(customerId); 62 | if (result.Success) 63 | { 64 | return Ok(result); 65 | } 66 | 67 | return BadRequest(result); 68 | } 69 | 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 | 80 | return BadRequest(result); 81 | } 82 | 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Core/Utilities/FileHelpers/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 class FileHelper 11 | { 12 | public static string Add(IFormFile file) 13 | { 14 | string sourcePath = Path.GetTempFileName(); 15 | string destFileNameForDb = CreateNewFilePathForDB(file); 16 | string destFileNameForLocalFolder = CreateNewFilePathForLocalFolder(destFileNameForDb); 17 | 18 | if (file.Length > 0) 19 | { 20 | using (var stream = new FileStream(sourcePath, FileMode.Create)) 21 | { 22 | file.CopyTo(stream); 23 | } 24 | } 25 | 26 | File.Move(sourcePath, destFileNameForLocalFolder); 27 | return destFileNameForDb; 28 | } 29 | 30 | public static IResult Delete(string path) 31 | { 32 | try 33 | { 34 | File.Delete(path); 35 | } 36 | catch (Exception exception) 37 | { 38 | return new ErrorResult(exception.Message); 39 | } 40 | 41 | return new SuccessResult(); 42 | } 43 | 44 | public static string Update(string sourcePath, IFormFile file) 45 | { 46 | string result = CreateNewFilePathForLocalFolder(CreateNewFilePathForDB(file)); 47 | 48 | if (sourcePath.Length > 0) 49 | { 50 | using (var stream = new FileStream(result, FileMode.Create)) 51 | { 52 | file.CopyTo(stream); 53 | } 54 | } 55 | 56 | File.Delete(sourcePath); 57 | return result; 58 | } 59 | 60 | public static string CreateNewFilePathForDB(IFormFile file) 61 | { 62 | FileInfo fileInfo = new FileInfo(file.FileName); 63 | string fileExtension = fileInfo.Extension; 64 | string newPath = Guid.NewGuid().ToString() + fileExtension; 65 | 66 | string result = $@"Images\{newPath}"; 67 | return result; 68 | } 69 | 70 | public static string CreateNewFilePathForLocalFolder(string pathForLocalFolder) 71 | { 72 | string path = Environment.CurrentDirectory + @"\wwwroot\" + pathForLocalFolder; 73 | return path; 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Core/CrossCuttingConcerns/Caching/Microsoft/MemoryCacheManager.cs: -------------------------------------------------------------------------------- 1 | using Core.Utilities.IoC; 2 | using Microsoft.Extensions.Caching.Memory; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using Microsoft.Extensions.DependencyInjection; 7 | using System.Text.RegularExpressions; 8 | using System.Linq; 9 | 10 | namespace Core.CrossCuttingConcerns.Caching.Microsoft 11 | { 12 | public class MemoryCacheManager : ICacheManager 13 | { 14 | // Adapter Pattern 15 | IMemoryCache _memoryCache; 16 | public MemoryCacheManager() 17 | { 18 | _memoryCache = ServiceTool.ServiceProvider.GetService(); 19 | } 20 | public void Add(string key, object value, int duration) 21 | { 22 | _memoryCache.Set(key, value, TimeSpan.FromMinutes(duration)); 23 | 24 | } 25 | 26 | public T Get(string key) 27 | { 28 | return _memoryCache.Get(key); 29 | } 30 | 31 | public object Get(string key) 32 | { 33 | return _memoryCache.Get(key); 34 | } 35 | 36 | public bool IsAdd(string key) 37 | { 38 | return _memoryCache.TryGetValue(key,out _); 39 | } 40 | 41 | public void Remove(string key) 42 | { 43 | _memoryCache.Remove(key); 44 | } 45 | 46 | public void RemoveByPattern(string pattern) 47 | { 48 | var cacheEntriesCollectionDefinition = typeof(MemoryCache).GetProperty("EntriesCollection", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); 49 | var cacheEntriesCollection = cacheEntriesCollectionDefinition.GetValue(_memoryCache) as dynamic; 50 | List cacheCollectionValues = new List(); 51 | 52 | foreach (var cacheItem in cacheEntriesCollection) 53 | { 54 | ICacheEntry cacheItemValue = cacheItem.GetType().GetProperty("Value").GetValue(cacheItem, null); 55 | cacheCollectionValues.Add(cacheItemValue); 56 | } 57 | 58 | var regex = new Regex(pattern, RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase); 59 | var keysToRemove = cacheCollectionValues.Where(d => regex.IsMatch(d.Key.ToString())).Select(d => d.Key).ToList(); 60 | 61 | foreach (var key in keysToRemove) 62 | { 63 | _memoryCache.Remove(key); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Business/DependencyResolvers/Autofac/AutofacBusinessModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Autofac.Extras.DynamicProxy; 3 | using Business.Abstack; 4 | using Business.Abstract; 5 | using Business.Concrete; 6 | using Castle.DynamicProxy; 7 | using Core.Utilities.Interceptors; 8 | using Core.Utilities.Security.JWT; 9 | using DataAccess.Abstack; 10 | using DataAccess.Concrete.EntityFramework; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | 15 | namespace Business.DependencyResolvers.Autofac 16 | { 17 | public class AutofacBusinessModule : Module 18 | { 19 | protected override void Load(ContainerBuilder builder) 20 | { 21 | builder.RegisterType().As().SingleInstance(); 22 | builder.RegisterType().As().SingleInstance(); 23 | 24 | builder.RegisterType().As().SingleInstance(); 25 | builder.RegisterType().As().SingleInstance(); 26 | 27 | builder.RegisterType().As().SingleInstance(); 28 | builder.RegisterType().As().SingleInstance(); 29 | 30 | builder.RegisterType().As().SingleInstance(); 31 | builder.RegisterType().As().SingleInstance(); 32 | 33 | builder.RegisterType().As().SingleInstance(); 34 | builder.RegisterType().As().SingleInstance(); 35 | 36 | builder.RegisterType().As().SingleInstance(); 37 | builder.RegisterType().As().SingleInstance(); 38 | 39 | builder.RegisterType().As().SingleInstance(); 40 | builder.RegisterType().As().SingleInstance(); 41 | 42 | 43 | builder.RegisterType().As().SingleInstance(); 44 | builder.RegisterType().As().SingleInstance(); 45 | 46 | 47 | builder.RegisterType().As(); 48 | 49 | var assembly = System.Reflection.Assembly.GetExecutingAssembly(); 50 | 51 | builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces() 52 | .EnableInterfaceInterceptors(new ProxyGenerationOptions() 53 | { 54 | Selector = new AspectInterceptorSelector() 55 | }).SingleInstance(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarImagesController.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 CarImagesController : ControllerBase 15 | { 16 | ICarImageService _carImageService; 17 | 18 | public CarImagesController(ICarImageService carImageService) 19 | { 20 | _carImageService = carImageService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _carImageService.GetAll(); 27 | 28 | if (result.Success) 29 | { 30 | return Ok(result); 31 | } 32 | 33 | return BadRequest(result); 34 | } 35 | 36 | [HttpGet("getbycarid")] 37 | public IActionResult GetByCarId(int carId) 38 | { 39 | var result = _carImageService.GetByCarId(carId); 40 | 41 | if (result.Success) 42 | { 43 | return Ok(result); 44 | } 45 | 46 | return BadRequest(result); 47 | } 48 | 49 | [HttpPost("add")] 50 | public IActionResult Add([FromForm(Name = ("Image"))] IFormFile file, [FromForm] CarImage carImage) 51 | { 52 | var result = _carImageService.Add(file, carImage); 53 | 54 | if (result.Success) 55 | { 56 | return Ok(result); 57 | } 58 | 59 | return BadRequest(result); 60 | } 61 | 62 | [HttpPost("update")] 63 | public IActionResult Update([FromForm(Name = ("Image"))] IFormFile file, [FromForm] int id) 64 | { 65 | var carImage = _carImageService.GetById(id).Data; 66 | var result = _carImageService.Update(file, carImage); 67 | 68 | if (result.Success) 69 | { 70 | return Ok(result); 71 | } 72 | 73 | return BadRequest(result); 74 | } 75 | 76 | [HttpPost("delete")] 77 | public IActionResult Delete([FromForm] int id) 78 | { 79 | var carImage = _carImageService.GetById(id).Data; 80 | var result = _carImageService.Delete(carImage); 81 | 82 | if (result.Success) 83 | { 84 | return Ok(result); 85 | } 86 | 87 | return BadRequest(result); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Business/Concrete/AuthManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Business.Abstract; 3 | using Business.Constants; 4 | using Core.Entities.Concrete; 5 | using Core.Utilities.Results; 6 | using Core.Utilities.Security.Hashing; 7 | using Core.Utilities.Security.JWT; 8 | using Entities.DTOs; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Text; 12 | 13 | namespace Business.Concrete 14 | { 15 | public class AuthManager : IAuthService 16 | { 17 | private IUserService _userService; 18 | private ITokenHelper _tokenHelper; 19 | 20 | public AuthManager(IUserService userService, ITokenHelper tokenHelper) 21 | { 22 | _userService = userService; 23 | _tokenHelper = tokenHelper; 24 | } 25 | 26 | public IDataResult Register(UserForRegisterDto userForRegisterDto, string password) 27 | { 28 | byte[] passwordHash, passwordSalt; 29 | HashingHelper.CreatePasswordHash(password, out passwordHash, out passwordSalt); 30 | var user = new User 31 | { 32 | Email = userForRegisterDto.Email, 33 | FirstName = userForRegisterDto.FirstName, 34 | LastName = userForRegisterDto.LastName, 35 | PasswordHash = passwordHash, 36 | PasswordSalt = passwordSalt, 37 | Status = true 38 | }; 39 | _userService.Add(user); 40 | return new SuccessDataResult(user, "Kayıt oldu"); 41 | } 42 | 43 | public IDataResult Login(UserForLoginDto userForLoginDto) 44 | { 45 | var userToCheck = _userService.GetByMail(userForLoginDto.Email); 46 | if (userToCheck == null) 47 | { 48 | return new ErrorDataResult("Kullanıcı bulunamadı"); 49 | } 50 | 51 | if (!HashingHelper.VerifyPasswordHash(userForLoginDto.Password, userToCheck.PasswordHash, userToCheck.PasswordSalt)) 52 | { 53 | return new ErrorDataResult("Parola hatası"); 54 | } 55 | 56 | return new SuccessDataResult(userToCheck, "Başarılı giriş"); 57 | } 58 | 59 | public IResult UserExists(string email) 60 | { 61 | if (_userService.GetByMail(email) != null) 62 | { 63 | return new ErrorResult("Kullanıcı mevcut"); 64 | } 65 | return new SuccessResult(); 66 | } 67 | 68 | public IDataResult CreateAccessToken(User user) 69 | { 70 | var claims = _userService.GetClaims(user); 71 | var accessToken = _tokenHelper.CreateToken(user, claims); 72 | return new SuccessDataResult(accessToken, "Token oluşturuldu"); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Core/Utilities/Security/JWT/JwtHelper.cs: -------------------------------------------------------------------------------- 1 | using Core.Entities.Concrete; 2 | using Core.Extensions; 3 | using Core.Utilities.Security.Encrypiton; 4 | using Microsoft.Extensions.Configuration; 5 | using Microsoft.IdentityModel.Tokens; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IdentityModel.Tokens.Jwt; 9 | using System.Linq; 10 | using System.Security.Claims; 11 | using System.Text; 12 | 13 | namespace Core.Utilities.Security.JWT 14 | { 15 | public class JwtHelper : ITokenHelper 16 | { 17 | public IConfiguration Configuration { get; } 18 | private TokenOptions _tokenOptions; 19 | private DateTime _accessTokenExpiration; 20 | public JwtHelper(IConfiguration configuration) 21 | { 22 | Configuration = configuration; 23 | _tokenOptions = Configuration.GetSection("TokenOptions").Get(); 24 | 25 | } 26 | public AccessToken CreateToken(User user, List operationClaims) 27 | { 28 | _accessTokenExpiration = DateTime.Now.AddMinutes(_tokenOptions.AccessTokenExpiration); 29 | var securityKey = SecurityKeyHelper.CreateSecurityKey(_tokenOptions.SecurityKey); 30 | var signingCredentials = SigningCredentialsHelper.CreateSigningCredentials(securityKey); 31 | var jwt = CreateJwtSecurityToken(_tokenOptions, user, signingCredentials, operationClaims); 32 | var jwtSecurityTokenHandler = new JwtSecurityTokenHandler(); 33 | var token = jwtSecurityTokenHandler.WriteToken(jwt); 34 | 35 | return new AccessToken 36 | { 37 | Token = token, 38 | Expiration = _accessTokenExpiration 39 | }; 40 | 41 | } 42 | 43 | public JwtSecurityToken CreateJwtSecurityToken(TokenOptions tokenOptions, User user, 44 | SigningCredentials signingCredentials, List operationClaims) 45 | { 46 | var jwt = new JwtSecurityToken( 47 | issuer: tokenOptions.Issuer, 48 | audience: tokenOptions.Audience, 49 | expires: _accessTokenExpiration, 50 | notBefore: DateTime.Now, 51 | claims: SetClaims(user, operationClaims), 52 | signingCredentials: signingCredentials 53 | ); 54 | return jwt; 55 | } 56 | 57 | private IEnumerable SetClaims(User user, List operationClaims) 58 | { 59 | var claims = new List(); 60 | claims.AddNameIdentifier(user.UserId.ToString()); 61 | claims.AddEmail(user.Email); 62 | claims.AddName($"{user.FirstName} {user.LastName}"); 63 | claims.AddRoles(operationClaims.Select(c => c.Name).ToArray()); 64 | 65 | return claims; 66 | } 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /ReCapProjectSon.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30804.86 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Entities", "Entities\Entities.csproj", "{3E2B2686-EBAA-42CB-B8A3-F0FB176DA28E}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataAccess", "DataAccess\DataAccess.csproj", "{833C2BDB-79A6-4CA6-847B-D2B561264DF7}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Business", "Business\Business.csproj", "{E3B9CDE1-5E7C-489C-8390-1C2C54134710}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{73715246-7864-42E2-BC9A-A24E386BBA78}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPI", "WebAPI\WebAPI.csproj", "{91011E85-D6FB-4383-9E08-81F2673DDB81}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {3E2B2686-EBAA-42CB-B8A3-F0FB176DA28E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {3E2B2686-EBAA-42CB-B8A3-F0FB176DA28E}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {3E2B2686-EBAA-42CB-B8A3-F0FB176DA28E}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {3E2B2686-EBAA-42CB-B8A3-F0FB176DA28E}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {833C2BDB-79A6-4CA6-847B-D2B561264DF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {833C2BDB-79A6-4CA6-847B-D2B561264DF7}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {833C2BDB-79A6-4CA6-847B-D2B561264DF7}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {833C2BDB-79A6-4CA6-847B-D2B561264DF7}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {E3B9CDE1-5E7C-489C-8390-1C2C54134710}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {E3B9CDE1-5E7C-489C-8390-1C2C54134710}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {E3B9CDE1-5E7C-489C-8390-1C2C54134710}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {E3B9CDE1-5E7C-489C-8390-1C2C54134710}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {73715246-7864-42E2-BC9A-A24E386BBA78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {73715246-7864-42E2-BC9A-A24E386BBA78}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {73715246-7864-42E2-BC9A-A24E386BBA78}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {73715246-7864-42E2-BC9A-A24E386BBA78}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {91011E85-D6FB-4383-9E08-81F2673DDB81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {91011E85-D6FB-4383-9E08-81F2673DDB81}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {91011E85-D6FB-4383-9E08-81F2673DDB81}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {91011E85-D6FB-4383-9E08-81F2673DDB81}.Release|Any CPU.Build.0 = Release|Any CPU 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | GlobalSection(ExtensibilityGlobals) = postSolution 47 | SolutionGuid = {90263163-079C-4C67-83EC-9EFF47264025} 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /WebAPI/Controllers/FakeCardsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 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 FakeCardsController : ControllerBase 15 | { 16 | IFakeCardService _fakeCardService; 17 | 18 | public FakeCardsController(IFakeCardService fakeCardService) 19 | { 20 | _fakeCardService = fakeCardService; 21 | } 22 | 23 | [HttpPost("add")] 24 | public IActionResult Add(FakeCard fakeCard) 25 | { 26 | var result = _fakeCardService.Add(fakeCard); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | 34 | [HttpPost("delete")] 35 | public IActionResult Delete(FakeCard fakeCard) 36 | { 37 | var result = _fakeCardService.Delete(fakeCard); 38 | if (result.Success) 39 | { 40 | return Ok(result); 41 | } 42 | return BadRequest(result); 43 | } 44 | 45 | [HttpPost("update")] 46 | public IActionResult Update(FakeCard fakeCard) 47 | { 48 | var result = _fakeCardService.Update(fakeCard); 49 | if (result.Success) 50 | { 51 | return Ok(result); 52 | } 53 | return BadRequest(result); 54 | } 55 | 56 | [HttpGet("getall")] 57 | public IActionResult GetAll() 58 | { 59 | var result = _fakeCardService.GetAll(); 60 | if (result.Success) 61 | { 62 | return Ok(result); 63 | } 64 | return BadRequest(result); 65 | } 66 | 67 | [HttpGet("getbyid")] 68 | public IActionResult GetById(int id) 69 | { 70 | var result = _fakeCardService.GetById(id); 71 | if (result.Success) 72 | { 73 | return Ok(result); 74 | } 75 | return BadRequest(result); 76 | } 77 | 78 | [HttpGet("getbycardnumber")] 79 | public IActionResult GetByCardNumber(string cardNumber) 80 | { 81 | var result = _fakeCardService.GetByCardNumber(cardNumber); 82 | if (result.Success) 83 | { 84 | return Ok(result); 85 | } 86 | return BadRequest(result); 87 | } 88 | 89 | [HttpPost("iscardexist")] 90 | public IActionResult IsCardExist(FakeCard fakeCard) 91 | { 92 | var result = _fakeCardService.IsCardExist(fakeCard); 93 | if (result.Success) 94 | { 95 | return Ok(result); 96 | } 97 | return Ok(result); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Business/Concrete/RentalManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Business.Constants; 3 | using Business.ValidationRules.FluentValidation; 4 | using Core.Aspects.Autofac.Validation; 5 | using Core.Utilities.Results; 6 | using DataAccess.Abstack; 7 | using Entities.Concrete; 8 | using Entities.DTOs; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Text; 12 | 13 | namespace Business.Concrete 14 | { 15 | public class RentalManager : IRentalService 16 | { 17 | IRentalDal _rentalDal; 18 | 19 | public RentalManager(IRentalDal rentalDal) 20 | { 21 | _rentalDal = rentalDal; 22 | } 23 | public IDataResult> GetAll() 24 | { 25 | return new SuccessDataResult>(_rentalDal.GetAll(), Messages.RentalListed); 26 | } 27 | public IDataResult> GetByRentalId(int id) 28 | { 29 | return new SuccessDataResult>(_rentalDal.GetAll(r => r.RentalId == id)); 30 | } 31 | public IDataResult> GetByCarId(int id) 32 | { 33 | return new SuccessDataResult>(_rentalDal.GetAll(r => r.CarId == id)); 34 | } 35 | public IDataResult> GetByCustomerId(int id) 36 | { 37 | return new SuccessDataResult>(_rentalDal.GetAll(r => r.CustomerId == id)); 38 | } 39 | public IDataResult> GetByRentDate(DateTime first, DateTime last) 40 | { 41 | return new SuccessDataResult>(_rentalDal.GetAll(r => r.RentDate == first && r.ReturnDate == last)); 42 | } 43 | public IDataResult CheckReturnDate(int carId) 44 | { 45 | List resultRental = _rentalDal.GetAll(r => r.CarId == carId && r.ReturnDate == null); 46 | if (resultRental.Count > 0) 47 | { 48 | return new ErrorDataResult(Messages.RentalUndeliveredCar); 49 | } 50 | 51 | return new SuccessDataResult(_rentalDal.Get(r => r.CarId == carId)); 52 | } 53 | public IDataResult> GetRentalDetails() 54 | { 55 | return new SuccessDataResult>(_rentalDal.GetRentalDetails(), Messages.RentalListed); 56 | } 57 | public IDataResult> GetRentalDetailsByCarId(int carId) 58 | { 59 | return new SuccessDataResult>(_rentalDal.GetRentalDetails(r => r.CarId == carId), Messages.RentalListed); 60 | } 61 | [ValidationAspect(typeof(RentalValidator))] 62 | public IResult Add(Rental rental) 63 | { 64 | _rentalDal.Add(rental); 65 | return new SuccessResult(Messages.RentalAdded); 66 | } 67 | public IResult Update(Rental rental) 68 | { 69 | _rentalDal.Update(rental); 70 | return new SuccessResult(Messages.RentalUpdated); 71 | } 72 | public IResult Delete(Rental rental) 73 | { 74 | _rentalDal.Delete(rental); 75 | return new SuccessResult(Messages.RentalDeleted); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Business/Constants/Messages.cs: -------------------------------------------------------------------------------- 1 | using Entities.Concrete; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Business.Constants 7 | { 8 | public class Messages 9 | { 10 | public static string CarAdded = "Araba eklendi."; 11 | public static string CarNameInvalid = "Araba adı geçersiz"; 12 | public static string CarListed = "Arabalar Listelendi"; 13 | public static string CarUpdate = "Araba Güncellendi"; 14 | public static string CarDelete = "Araba Kayıdı Silindi"; 15 | 16 | public static string CarImageListed = "Araba resimleri listelendi"; 17 | public static string CarImageAdded = "Araba resmi eklendi"; 18 | public static string CarImageUpdated = "Araba resmi güncellendi"; 19 | public static string FailAddedImageLimit = "Resim limitine erişildi"; 20 | 21 | public static string BrandAdded = "Marka eklendi."; 22 | public static string BrandNameInvalid = "Marka adı geçersiz"; 23 | public static string BrandListed = "Markalar Listelendi"; 24 | 25 | public static string ColorListed = "Colors Listelendi"; 26 | public static string ColorAdded = "Color eklendi."; 27 | public static string ColorNameInvalid = "Color adı geçersiz"; 28 | 29 | public static string RentalAdded = "Kiralama eklendi"; 30 | public static string RentalDeleted = "Kiralama silindi"; 31 | public static string RentalRentDateInvalid = "Kiralama tarihi geçersiz"; 32 | public static string RentalReturnDateInvalid = "Kiralama dönüş tarihi geçersiz"; 33 | public static string RentalUndeliveredCar = "Araç henüz teslim edilmedi."; 34 | public static string RentalListed = "Kiralamalar listelendi"; 35 | public static string RentalUpdated = "Kiralama güncellendi"; 36 | 37 | public static string CustomerAdded = "Müşteri eklendi"; 38 | public static string CustomerCompanyNameInvalid = "Müşteri firma ismi geçersiz"; 39 | public static string CustomerListed = "Müşteri listelendi"; 40 | public static string CustomerUpdated = "Müşteri güncellendi"; 41 | 42 | public static string UserListed = "Users Listelendi"; 43 | public static string UserAdded = "User eklendi."; 44 | public static string UserInvalid = "User adı geçersiz"; 45 | 46 | public static string MaintenanceTime = "Sistem Bakımda"; 47 | public static string ImageDelete = "Sistem Bakımda"; 48 | public static string ImageUpdate = "Sistem Bakımda"; 49 | public static string CarImagesCount = "Sistem Bakımda"; 50 | public static string ImageAdded = "Sistem Bakımda"; 51 | 52 | public static string CarImageLimitExceeded = "Car Image Limit Exceeded!"; 53 | 54 | 55 | public static string AuthorizationDenied = "Yetkiniz yok"; 56 | public static string CustomerDelete { get; internal set; } 57 | public static string CustomerUpdate { get; internal set; } 58 | public static string RentalDelete { get; internal set; } 59 | public static string RentalUpdate { get; internal set; } 60 | public static string UserDelete { get; internal set; } 61 | public static string UserUpdate { get; internal set; } 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /WebAPI/Startup.cs: -------------------------------------------------------------------------------- 1 | using Core.DependencyResolvers; 2 | using Core.Extensions; 3 | using System.IO; 4 | using Core.Utilities.IoC; 5 | using Core.Utilities.Security.Encrypiton; 6 | using Core.Utilities.Security.JWT; 7 | using Microsoft.AspNetCore.Authentication.JwtBearer; 8 | using Microsoft.AspNetCore.Builder; 9 | using Microsoft.AspNetCore.Hosting; 10 | using Microsoft.AspNetCore.Http; 11 | using Microsoft.Extensions.Configuration; 12 | using Microsoft.Extensions.DependencyInjection; 13 | using Microsoft.Extensions.Hosting; 14 | using Microsoft.IdentityModel.Tokens; 15 | using Microsoft.Extensions.FileProviders; 16 | 17 | namespace WebAPI 18 | { 19 | public class Startup 20 | { 21 | public Startup(IConfiguration configuration) 22 | { 23 | Configuration = configuration; 24 | } 25 | 26 | public IConfiguration Configuration { get; } 27 | 28 | // This method gets called by the runtime. Use this method to add services to the container. 29 | public void ConfigureServices(IServiceCollection services) 30 | { 31 | services.AddControllers(); 32 | //services.AddSingleton(); 33 | //services.AddSingleton(); 34 | services.AddCors(); 35 | services.AddSingleton(); 36 | var tokenOptions = Configuration.GetSection("TokenOptions").Get(); 37 | 38 | services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) 39 | .AddJwtBearer(options => 40 | { 41 | options.TokenValidationParameters = new TokenValidationParameters 42 | { 43 | ValidateIssuer = true, 44 | ValidateAudience = true, 45 | ValidateLifetime = true, 46 | ValidIssuer = tokenOptions.Issuer, 47 | ValidAudience = tokenOptions.Audience, 48 | ValidateIssuerSigningKey = true, 49 | IssuerSigningKey = SecurityKeyHelper.CreateSecurityKey(tokenOptions.SecurityKey) 50 | }; 51 | }); 52 | services.AddDependencyResolvers(new ICoreModule[] { 53 | new CoreModule() 54 | }); 55 | 56 | } 57 | 58 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 59 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 60 | { 61 | if (env.IsDevelopment()) 62 | { 63 | app.UseDeveloperExceptionPage(); 64 | } 65 | app.ConfigureCustomExceptionMiddleware(); 66 | 67 | 68 | app.UseCors(builder => builder.WithOrigins("http://localhost:4200").AllowAnyHeader()); 69 | 70 | app.UseStaticFiles(); 71 | 72 | app.UseHttpsRedirection(); 73 | 74 | app.UseRouting(); 75 | 76 | app.UseAuthentication(); 77 | 78 | app.UseAuthorization(); 79 | 80 | app.UseEndpoints(endpoints => 81 | { 82 | endpoints.MapControllers(); 83 | }); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Business/Concrete/CarImageManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstract; 2 | using Business.Constants; 3 | using Business.ValidationRules.FluentValidation; 4 | using Core.Aspects.Autofac.Validation; 5 | using Core.Utilities.Business; 6 | using Core.Utilities.Helpers; 7 | using Core.Utilities.Results; 8 | using DataAccess.Abstack; 9 | using Entities.Concrete; 10 | using Microsoft.AspNetCore.Http; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | 16 | namespace Business.Concrete 17 | { 18 | public class CarImageManager : ICarImageService 19 | { 20 | ICarImagesDal _carImageDal; 21 | public CarImageManager(ICarImagesDal carImageDal) 22 | { 23 | _carImageDal = carImageDal; 24 | } 25 | [ValidationAspect(typeof(CarImageValidator))] 26 | public IResult Add(IFormFile file, CarImage carImage) 27 | { 28 | IResult result = BusinessRules.Run(CheckIfCarImageLimitExceeded(carImage.CarId)); 29 | 30 | if (result != null) 31 | { 32 | return result; 33 | } 34 | carImage.ImagePath = FileHelper.Add(file); 35 | carImage.ImageDate = DateTime.Now; 36 | _carImageDal.Add(carImage); 37 | return new SuccessResult(Messages.CarImageAdded); 38 | } 39 | [ValidationAspect(typeof(CarImageValidator))] 40 | public IResult Delete(CarImage carImage) 41 | { 42 | FileHelper.Delete(carImage.ImagePath); 43 | _carImageDal.Delete(carImage); 44 | return new SuccessResult(); 45 | } 46 | [ValidationAspect(typeof(CarImageValidator))] 47 | public IResult Update(IFormFile file, CarImage carImage) 48 | { 49 | carImage.ImagePath = FileHelper.Update(_carImageDal.Get(c => c.Id == carImage.Id).ImagePath, file); 50 | carImage.ImageDate = DateTime.Now; 51 | _carImageDal.Update(carImage); 52 | return new SuccessResult(); 53 | } 54 | [ValidationAspect(typeof(CarImageValidator))] 55 | public IDataResult GetById(int id) 56 | { 57 | return new SuccessDataResult(_carImageDal.Get(c => c.Id == id)); 58 | } 59 | [ValidationAspect(typeof(CarImageValidator))] 60 | public IDataResult> GetByCarId(int carId) 61 | { 62 | 63 | List carImageList = _carImageDal.GetAll(c => c.CarId == carId); 64 | return new SuccessDataResult>(carImageList); 65 | } 66 | [ValidationAspect(typeof(CarImageValidator))] 67 | public IDataResult> GetAll() 68 | { 69 | return new SuccessDataResult>(_carImageDal.GetAll()); 70 | } 71 | private IResult CheckIfCarImageLimitExceeded(int carId) 72 | { 73 | var carImagecount = _carImageDal.GetAll(p => p.CarId == carId).Count; 74 | if (carImagecount >= 5) 75 | { 76 | return new ErrorResult(Messages.CarImageLimitExceeded); 77 | } 78 | return new SuccessResult(); 79 | } 80 | private List CheckIfAnyCarImageExists(int carId) 81 | { 82 | string path = Environment.CurrentDirectory + @"\images\DefaultCar.jpg"; 83 | var result = _carImageDal.GetAll(c => c.CarId == carId).Any(); 84 | 85 | if (result) 86 | { 87 | return _carImageDal.GetAll(p => p.CarId == carId); 88 | } 89 | return new List { new CarImage { CarId = carId, ImagePath = path, ImageDate = DateTime.Now } }; 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /Business/Concrete/CarManager.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using Business.Constants; 3 | using Business.ValidationRules.FluentValidation; 4 | using Core.Aspects.Autofac.Caching; 5 | using Core.Aspects.Autofac.Validation; 6 | using Core.Utilities.Results; 7 | using DataAccess.Abstack; 8 | using Entities.Concrete; 9 | using Entities.DTOs; 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Text; 13 | 14 | namespace Business.Concrete 15 | { 16 | public class CarManager : ICarService 17 | { 18 | ICarDal _car; 19 | 20 | public CarManager(ICarDal car) 21 | { 22 | _car = car; 23 | } 24 | 25 | public IResult Delete(Car car) 26 | { 27 | _car.Delete(car); 28 | return new SuccessResult(Messages.CarDelete); 29 | } 30 | 31 | public IDataResult> GetAll() 32 | { 33 | if (DateTime.Now.Hour == 21) 34 | { 35 | return new ErrorDataResult>(Messages.MaintenanceTime); 36 | } 37 | 38 | return new SuccessDataResult>(_car.GetAll(), Messages.CarListed); 39 | } 40 | 41 | public IDataResult> GetCarDetails() 42 | { 43 | return new SuccessDataResult>(_car.GetCarDetails()); 44 | } 45 | 46 | public IDataResult> GetCarsByBrandId(int id) 47 | { 48 | return new SuccessDataResult>(_car.GetAll(c => c.BrandId == id)); 49 | } 50 | 51 | public IDataResult> GetCarsByColorId(int id) 52 | { 53 | return new SuccessDataResult>(_car.GetAll(c=>c.ColorId==id)); 54 | } 55 | 56 | public IResult Update(Car car) 57 | { 58 | _car.Update(car); 59 | return new SuccessResult(Messages.CarUpdate); 60 | } 61 | 62 | [ValidationAspect(typeof(CarValidator))] 63 | public IResult Add(Car car) 64 | { 65 | 66 | _car.Add(car); 67 | return new SuccessResult(Messages.CarAdded); 68 | 69 | } 70 | 71 | public IDataResult> GetCarsByFilter(int brandId, int colorId) 72 | { 73 | return new SuccessDataResult>(_car.GetCarsByFilter(colorId, brandId)); 74 | } 75 | 76 | public IDataResult> GetCarsByBrandIdList(int brandId) 77 | { 78 | return new SuccessDataResult>(_car.GetCarDetails(c => c.BrandId == brandId)); 79 | } 80 | 81 | public IDataResult> GetCarsByColorIdList(int colorId) 82 | { 83 | return new SuccessDataResult>(_car.GetCarDetails(c => c.ColorId == colorId)); 84 | } 85 | 86 | [CacheAspect] 87 | public IDataResult> GetCarDetailsByCarId(int carId) 88 | { 89 | return new SuccessDataResult>(_car.GetCarDetails(c => c.Id == carId)); 90 | } 91 | 92 | public IDataResult> GetCarDetailsById(int carId) 93 | { 94 | return new SuccessDataResult>(_car.GetCarDetails(c => c.Id == carId), Messages.CarListed); 95 | } 96 | 97 | public IDataResult> GetCarDetailsByBrandAndColorId(int brandId, int colorId) 98 | { 99 | return new SuccessDataResult>(_car.GetCarDetails(c => c.BrandId == brandId && c.ColorId == colorId), Messages.CarListed); 100 | } 101 | 102 | public IDataResult> GetCarsDetailsByBrandId(int id) 103 | { 104 | 105 | List carDetailDto = _car.GetCarsDetailsByBrandId(id); 106 | 107 | var result = CheckNullImageList(carDetailDto); 108 | 109 | return new SuccessDataResult>(result, Messages.BrandListed); 110 | } 111 | private List CheckNullImageList(List carDetailDtos) 112 | { 113 | 114 | foreach (var carDetailDto in carDetailDtos) 115 | { 116 | CheckNullImageSingle(carDetailDto.CarImages, carDetailDto.CarId); 117 | } 118 | return carDetailDtos; 119 | } 120 | private List CheckNullImageSingle(List carImages, int carId) 121 | { 122 | string path = @"\Uploads\default.jpg"; 123 | if (carImages.Count == 0) 124 | { 125 | carImages.Add(new CarImage { ImagePath = path, CarId = carId, ImageDate = null }); 126 | } 127 | return carImages; 128 | } 129 | 130 | public IDataResult> GetCarsDetailsByColorId(int id) 131 | { 132 | List carDetailDto = _car.GetCarsDetailsByColorId(id); 133 | 134 | var result = CheckNullImageList(carDetailDto); 135 | 136 | return new SuccessDataResult>(result, Messages.ColorListed); 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /WebAPI/Controllers/CarsController.cs: -------------------------------------------------------------------------------- 1 | using Business.Abstack; 2 | using DataAccess.Abstack; 3 | using Entities.Concrete; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.AspNetCore.Mvc; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Threading.Tasks; 10 | 11 | namespace WebAPI.Controllers 12 | { 13 | [Route("api/[controller]")] 14 | [ApiController] 15 | public class CarsController : ControllerBase 16 | { 17 | ICarService _carservice; 18 | public CarsController(ICarService carService) 19 | { 20 | _carservice = carService; 21 | } 22 | 23 | [HttpGet("getall")] 24 | public IActionResult GetAll() 25 | { 26 | var result = _carservice.GetAll(); 27 | if (result.Success) 28 | { 29 | return Ok(result); 30 | } 31 | return BadRequest(result); 32 | } 33 | [HttpGet("getcarsbrandid")] 34 | public IActionResult GetCarsByBrandId(int brandId) 35 | { 36 | var result = _carservice.GetCarsByBrandId(brandId); 37 | if (result.Success) 38 | { 39 | return Ok(result); 40 | } 41 | return BadRequest(result); 42 | } 43 | [HttpGet("getcarcolorid")] 44 | public IActionResult GetCarsByColorId(int id) 45 | { 46 | var result = _carservice.GetCarsByColorId(id); 47 | if (result.Success) 48 | { 49 | return Ok(result); 50 | } 51 | return BadRequest(result); 52 | } 53 | [HttpGet("getcardetail")] 54 | public IActionResult GetCarDetail() 55 | { 56 | var result = _carservice.GetCarDetails(); 57 | if (result.Success) 58 | { 59 | return Ok(result); 60 | } 61 | return BadRequest(result); 62 | } 63 | 64 | [HttpGet("getcarsdetailsbybrandid")] 65 | public IActionResult GetCarsDetailsByBrandId(int brandId) 66 | { 67 | var result = _carservice.GetCarsDetailsByBrandId(brandId); 68 | if (result.Success) 69 | { 70 | return Ok(result); 71 | } 72 | return BadRequest(result); 73 | 74 | } 75 | [HttpGet("getcarsdetailsbycolorid")] 76 | public IActionResult GetCarsDetailsByColorId(int colorId) 77 | { 78 | var result = _carservice.GetCarsDetailsByColorId(colorId); 79 | if (result.Success) 80 | { 81 | return Ok(result); 82 | } 83 | return BadRequest(result); 84 | 85 | } 86 | [HttpGet("getcardetailbycarid")] 87 | public IActionResult GetCarDetailsByCarId(int carId) 88 | { 89 | var result = _carservice.GetCarDetailsByCarId(carId); 90 | if (result.Success) 91 | { 92 | return Ok(result); 93 | } 94 | 95 | return BadRequest(result); 96 | } 97 | [HttpGet("getcarsdetailbycolorid")] 98 | public IActionResult GetCarsByColorIdList(int colorId) 99 | { 100 | var result = _carservice.GetCarsByColorIdList(colorId); 101 | if (result.Success) 102 | { 103 | return Ok(result); 104 | } 105 | 106 | return BadRequest(result); 107 | } 108 | 109 | [HttpGet("getcarsbyfilter")] 110 | public IActionResult GetCarsByFilter(int colorId, int brandId) 111 | { 112 | var result = _carservice.GetCarsByFilter(colorId, brandId); 113 | 114 | if (result.Success) 115 | { 116 | return Ok(result); 117 | } 118 | 119 | return BadRequest(result.Message); 120 | } 121 | 122 | [HttpGet("getcarsbybrandid")] 123 | public IActionResult GetCarsByBrandIdList(int brandId) 124 | { 125 | var result = _carservice.GetCarsByBrandIdList(brandId); 126 | if (result.Success) 127 | { 128 | return Ok(result); 129 | } 130 | 131 | return BadRequest(result); 132 | } 133 | [HttpGet("getcardetailsbyid")] 134 | public IActionResult GetCarDetailsById(int carId) 135 | { 136 | var result = _carservice.GetCarDetailsById(carId); 137 | 138 | if (result.Success) 139 | { 140 | return Ok(result); 141 | } 142 | 143 | return BadRequest(result); 144 | } 145 | 146 | 147 | [HttpGet("getcardetailsbybrandandcolorid")] 148 | public IActionResult GetCarDetailsByBrandAndColorId(int brandId, int colorId) 149 | { 150 | var result = _carservice.GetCarDetailsByBrandAndColorId(brandId, colorId); 151 | 152 | if (result.Success) 153 | { 154 | return Ok(result); 155 | } 156 | 157 | return BadRequest(result); 158 | } 159 | 160 | [HttpPost("add")] 161 | public IActionResult Add(Car car) 162 | { 163 | var result = _carservice.Add(car); 164 | if (result.Success) 165 | { 166 | return Ok(result); 167 | } 168 | return BadRequest(result); 169 | } 170 | [HttpPost("delete")] 171 | public IActionResult Delete(Car car) 172 | { 173 | var result = _carservice.Delete(car); 174 | if (result.Success) 175 | { 176 | return Ok(result); 177 | } 178 | return BadRequest(result); 179 | } 180 | [HttpPost("update")] 181 | public IActionResult Update(Car car) 182 | { 183 | var result = _carservice.Update(car); 184 | if (result.Success) 185 | { 186 | return Ok(result); 187 | } 188 | return BadRequest(result); 189 | } 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /DataAccess/Concrete/EntityFramework/EfCarDal.cs: -------------------------------------------------------------------------------- 1 | using Core.DataAccess.EntityFramework; 2 | using DataAccess.Abstack; 3 | using Entities.Concrete; 4 | using Entities.DTOs; 5 | using Microsoft.EntityFrameworkCore; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Linq.Expressions; 10 | using System.Text; 11 | 12 | namespace DataAccess.Concrete.EntityFramework 13 | { 14 | public class EfCarDal : EfEntityRepositoryBase, ICarDal 15 | { 16 | public List GetCarDetails(Expression> filter = null) 17 | { 18 | using (CarDbContext context=new CarDbContext()) 19 | { 20 | var result = from cr in filter == null ? context.Cars : context.Cars.Where(filter) 21 | join b in context.Brands on cr.BrandId equals b.BrandId 22 | join cl in context.Colors on cr.ColorId equals cl.ColorId 23 | select new CarDetailDto 24 | { 25 | CarId = cr.Id, 26 | CarName = cr.CarName, 27 | BrandId = b.BrandId, 28 | ColorId = cl.ColorId, 29 | BrandName = b.BrandName, 30 | ColorName = cl.ColorName, 31 | DailyPrice = cr.DailyPrice, 32 | ModelYear = cr.ModelYear, 33 | Descriptions = cr.Description, 34 | CarImages= (from img in context.CarImages 35 | where (cr.Id == img.CarId) 36 | select new CarImage { Id = img.Id, CarId = cr.Id, ImageDate = img.ImageDate, ImagePath = img.ImagePath }).ToList() 37 | }; 38 | return result.ToList(); 39 | } 40 | } 41 | 42 | public List GetCarsDetailsByBrandId(int id) 43 | { 44 | using (CarDbContext context = new CarDbContext()) 45 | { 46 | var result = from c in context.Cars 47 | join b in context.Brands on c.BrandId equals b.BrandId 48 | join col in context.Colors on c.ColorId equals col.ColorId 49 | where (b.BrandId == id) 50 | select new CarDetailDto 51 | { 52 | CarId = c.Id, 53 | CarName = c.CarName, 54 | BrandName = b.BrandName, 55 | ColorName = col.ColorName, 56 | DailyPrice = c.DailyPrice, 57 | ModelYear = c.ModelYear, 58 | Descriptions = c.Description, 59 | CarImages = (from img in context.CarImages 60 | where (c.Id == img.CarId) 61 | select new CarImage { Id = img.Id, CarId = c.Id, ImageDate = img.ImageDate, ImagePath = img.ImagePath }).ToList() 62 | }; 63 | return result.ToList(); 64 | } 65 | } 66 | public List GetCarsDetailsByColorId(int id) 67 | { 68 | using (CarDbContext context = new CarDbContext()) 69 | { 70 | var result = from c in context.Cars 71 | join b in context.Brands on c.BrandId equals b.BrandId 72 | join col in context.Colors on c.ColorId equals col.ColorId 73 | where (col.ColorId == id) 74 | select new CarDetailDto 75 | { 76 | CarId = c.Id, 77 | CarName = c.CarName, 78 | BrandName = b.BrandName, 79 | ColorName = col.ColorName, 80 | DailyPrice = c.DailyPrice, 81 | ModelYear = c.ModelYear, 82 | Descriptions = c.Description, 83 | CarImages = (from img in context.CarImages 84 | where (c.Id == img.CarId) 85 | select new CarImage { Id = img.Id, CarId = c.Id, ImageDate = img.ImageDate, ImagePath = img.ImagePath }).ToList() 86 | }; 87 | return result.ToList(); 88 | } 89 | } 90 | 91 | public List GetCarsByFilter(int colorId, int brandId) 92 | { 93 | using (CarDbContext context = new CarDbContext()) 94 | { 95 | var result = from c in context.Cars 96 | join col in context.Colors on c.ColorId equals col.ColorId 97 | join b in context.Brands on c.BrandId equals b.BrandId 98 | 99 | where c.ColorId ==colorId && c.BrandId==brandId 100 | select new CarDetailDto 101 | { 102 | CarId = c.Id, 103 | CarName = c.CarName, 104 | BrandName = b.BrandName, 105 | ColorName = col.ColorName, 106 | DailyPrice = c.DailyPrice, 107 | ModelYear = c.ModelYear, 108 | Descriptions = c.Description, 109 | CarImages = (from img in context.CarImages 110 | where (c.Id == img.CarId) 111 | select new CarImage { Id = img.Id, CarId = c.Id, ImageDate = img.ImageDate, ImagePath = img.ImagePath }).ToList() 112 | }; 113 | return result.ToList(); 114 | } 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /ConsolePrj/Program.cs: -------------------------------------------------------------------------------- 1 | using Business.Concrete; 2 | using DataAccess.Concrete; 3 | using DataAccess.Concrete.EntityFramework; 4 | using Entities.Concrete; 5 | using System; 6 | 7 | 8 | namespace ConsolePrj 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | //CarText(); 15 | //CarText1(); 16 | RentalManager rentalManager = new RentalManager(new EfRentalDal()); 17 | CustomerManager customerManager = new CustomerManager(new EfCustomerDal()); 18 | //var kira = 0; 19 | // Müşteri Ekleme 20 | Customer customer1 = new Customer(); 21 | customer1.CustomerId =5; 22 | customer1.UserId = 3; 23 | customer1.CompanyName = "Sirket5"; 24 | 25 | Customer customer2 = new Customer(); 26 | customer1.CustomerId = 5; 27 | customer1.UserId = 3; 28 | customer1.CompanyName = "Sirket5"; 29 | 30 | Customer customer3 = new Customer(); 31 | customer1.CustomerId = 5; 32 | customer1.UserId = 3; 33 | customer1.CompanyName = "Sirket5"; 34 | 35 | Customer customer4 = new Customer(); 36 | customer1.CustomerId = 5; 37 | customer1.UserId = 3; 38 | customer1.CompanyName = "Sirket5"; 39 | 40 | customerManager.Add(customer1); 41 | customerManager.Add(customer2); 42 | customerManager.Add(customer3); 43 | customerManager.Add(customer4); 44 | 45 | //if (kira==0) 46 | //{ 47 | // Rental rental = new Rental(); 48 | // rental.Id = 5; 49 | // rental.CustomerId = 3; 50 | // rental.CarId = 2; 51 | // rental.RentDate = "12/02/2021"; 52 | // rental.ReturnDate = "12/03/2021"; 53 | // if (rental.ReturnDate!=null) 54 | // { 55 | // Console.WriteLine("Bu işlemi yapmazsınız."); 56 | // } 57 | // else 58 | // { 59 | // rentalManager.Add(rental); 60 | 61 | // } 62 | 63 | 64 | //} 65 | 66 | 67 | 68 | 69 | 70 | 71 | } 72 | 73 | private static void CarText1() 74 | { 75 | CarManager carManager = new CarManager(new EfCarDal()); 76 | 77 | //foreach (var car in carManager.GetCarDetails().Data) 78 | //{ 79 | // Console.WriteLine("Car Name : " + car.CarName + "\t Brand Name :" + car.BrandName + 80 | // "\t Color Name : " + car.ColorName + "\t DailyPrice : " + car.DailyPrice); 81 | //} 82 | } 83 | 84 | private static void CarText() 85 | { 86 | CarManager carManager = new CarManager(new EfCarDal()); 87 | 88 | Console.WriteLine("Hangi işlemi yapmak istersiniz? \n 1- Araba Listeleme \n 2- Marka Listeleme \n 3- Renk Listeleme \n 2- Ekleme \n 3-Cıkıs"); 89 | var cevap = Convert.ToInt32(Console.ReadLine()); 90 | var baslangic = 0; 91 | switch (cevap) 92 | { 93 | case 1: 94 | Console.WriteLine("------------------------------------------------Arabalar Listesi---------------------------------------------"); 95 | foreach (var car in carManager.GetAll().Data) 96 | { 97 | Console.WriteLine("CarId: {0}, CarName: {1}, BrandId: {2}, ColorId: {3}, DailyPrice: {4}, ModelYear: {5}, Description: {6}", 98 | car.Id, car.CarName, car.BrandId, car.ColorId, car.DailyPrice, car.ModelYear, car.Description); 99 | } 100 | break; 101 | 102 | case 2: 103 | Console.WriteLine("------------------------------------------------Markaya Göre Listeleme---------------------------------------------"); 104 | Console.WriteLine("Hangi BrandId araba arıyorsunuz."); 105 | baslangic = Convert.ToInt32(Console.ReadLine()); 106 | foreach (var car in carManager.GetCarsByBrandId(baslangic).Data) 107 | { 108 | 109 | Console.WriteLine("CarId: {0}, CarName: {1}, BrandId: {2}, ColorId: {3}, DailyPrice: {4}, ModelYear: {5}, Description: {6}", 110 | car.Id, car.CarName, car.BrandId, car.ColorId, car.DailyPrice, car.ModelYear, car.Description); 111 | } 112 | 113 | 114 | break; 115 | case 3: 116 | Console.WriteLine("------------------------------------------------Renge Göre Listeleme---------------------------------------------"); 117 | Console.WriteLine("Hangi ColorId araba arıyorsunuz."); 118 | baslangic = Convert.ToInt32(Console.ReadLine()); 119 | foreach (var car in carManager.GetCarsByColorId(baslangic).Data) 120 | { 121 | 122 | Console.WriteLine("CarId: {0}, CarName: {1}, BrandId: {2}, ColorId: {3}, DailyPrice: {4}, ModelYear: {5}, Description: {6}", 123 | car.Id, car.CarName, car.BrandId, car.ColorId, car.DailyPrice, car.ModelYear, car.Description); 124 | } 125 | 126 | 127 | break; 128 | 129 | case 4: 130 | Console.WriteLine("------------------------------------------------Ekleme İşlemi---------------------------------------------"); 131 | Car car1 = new Car(); 132 | Console.WriteLine("Car Id: "); 133 | car1.Id = Convert.ToInt32(Console.ReadLine()); 134 | Console.WriteLine("Car Name: "); 135 | car1.CarName = Console.ReadLine(); 136 | Console.WriteLine("Brand Id: "); 137 | car1.BrandId = Convert.ToInt32(Console.ReadLine()); 138 | Console.WriteLine("Color Id: "); 139 | car1.ColorId = Convert.ToInt32(Console.ReadLine()); 140 | Console.WriteLine("Daily Price: "); 141 | car1.DailyPrice = Convert.ToInt32(Console.ReadLine()); 142 | Console.WriteLine("Model Year: "); 143 | car1.ModelYear = Console.ReadLine(); 144 | Console.WriteLine("Description: "); 145 | car1.Description = Console.ReadLine(); 146 | carManager.Add(car1); 147 | 148 | break; 149 | default: 150 | break; 151 | } 152 | } 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /.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 --------------------------------------------------------------------------------