├── .circleci └── config.yml ├── .editorconfig ├── .gitattributes ├── .github └── workflows │ ├── codeql.yml │ └── stale.yml ├── .gitignore ├── BlazorShop.Application ├── BlazorShop.Application.csproj ├── Commands │ ├── AccountCommand │ │ ├── ChangePasswordCommand.cs │ │ ├── LoginCommand.cs │ │ ├── RegisterCommand.cs │ │ └── ResetPasswordCommand.cs │ ├── CartCommand │ │ ├── CreateCartCommand.cs │ │ ├── DeleteAllCartsCommand.cs │ │ ├── DeleteCartCommand.cs │ │ └── UpdateCartCommand.cs │ ├── ClotheCommand │ │ ├── CreateClotheCommand.cs │ │ ├── DeleteClotheCommand.cs │ │ └── UpdateClotheCommand.cs │ ├── InvoiceCommand │ │ ├── CreateInvoiceCommand.cs │ │ ├── DeleteInvoiceCommand.cs │ │ └── UpdateInvoiceCommand.cs │ ├── MusicCommand │ │ ├── CreateMusicCommand.cs │ │ ├── DeleteMusicCommand.cs │ │ └── UpdateMusicCommand.cs │ ├── OrderCommand │ │ ├── CreateOrderCommand.cs │ │ ├── DeleteOrderCommand.cs │ │ └── UpdateOrderCommand.cs │ ├── ReceiptCommand │ │ ├── CreateReceiptCommand.cs │ │ ├── DeleteReceiptCommand.cs │ │ └── UpdateReceiptCommand.cs │ ├── RoleCommand │ │ ├── CreateRoleCommand.cs │ │ ├── DeleteRoleCommand.cs │ │ └── UpdateRoleCommand.cs │ ├── SubscriberCommand │ │ ├── CreateSubscriberCommand.cs │ │ ├── DeleteSubscriberCommand.cs │ │ ├── UpdateCreatedSubscriberCommand.cs │ │ ├── UpdateSubscriberCommand.cs │ │ └── UpdateSubscriberStatusCommand.cs │ ├── SubscriptionCommand │ │ ├── CreateSubscriptionCommand.cs │ │ ├── DeleteSubscriptionCommand.cs │ │ └── UpdateSubscriptionCommand.cs │ ├── TodoItemCommand │ │ ├── CreateTodoItemCommand.cs │ │ ├── DeleteTodoItemCommand.cs │ │ └── UpdateTodoItemCommand.cs │ ├── TodoListCommand │ │ ├── CreateTodoListCommand.cs │ │ ├── DeleteTodoListCommand.cs │ │ └── UpdateTodoListCommand.cs │ └── UserCommand │ │ ├── ActivateUserCommand.cs │ │ ├── AssignUserToRoleCommand.cs │ │ ├── CreateUserCommand.cs │ │ ├── DeleteUserCommand.cs │ │ ├── UpdateUserCommand.cs │ │ └── UpdateUserEmailCommand.cs ├── Common │ ├── Behaviours │ │ ├── AuthorizationBehaviour.cs │ │ ├── LoggingBehaviour.cs │ │ ├── UnhandledExceptionBehaviour.cs │ │ └── ValidationBehaviour.cs │ ├── Exceptions │ │ ├── ForbiddenAccessException.cs │ │ └── ValidationException.cs │ ├── Interfaces │ │ ├── IAccountService.cs │ │ ├── IApplicationDbContext.cs │ │ ├── ICsvFileBuilder.cs │ │ ├── ICurrentUserService.cs │ │ ├── IDateTimeService.cs │ │ ├── IEmailService.cs │ │ ├── IRoleService.cs │ │ └── IUserService.cs │ ├── Mappings │ │ ├── IMapFrom.cs │ │ ├── MappingExtensions.cs │ │ └── MappingProfile.cs │ ├── Models │ │ ├── EmailSettings.cs │ │ ├── JwtTokenConfig.cs │ │ ├── JwtTokenResponse.cs │ │ ├── PaginatedList.cs │ │ ├── RequestResponse.cs │ │ └── Result.cs │ └── Security │ │ └── AuthorizeAttribute.cs ├── DependencyInjection.cs ├── Handlers │ ├── Commands │ │ ├── AccountHandler │ │ │ ├── ChangePasswordCommandHandler.cs │ │ │ ├── LoginCommandHandler.cs │ │ │ ├── RegisterCommandHandler.cs │ │ │ └── ResetPasswordCommandHandler.cs │ │ ├── CartHandler │ │ │ ├── CreateCartCommandHandler.cs │ │ │ ├── DeleteAllCartsCommandHandler.cs │ │ │ ├── DeleteCartCommandHandler.cs │ │ │ └── UpdateCartCommandHandler.cs │ │ ├── ClotheHandler │ │ │ ├── CreateClotheCommandHandler.cs │ │ │ ├── DeleteClotheCommandHandler.cs │ │ │ └── UpdateClotheCommandHandler.cs │ │ ├── InvoiceHandler │ │ │ ├── CreateInvoiceCommandHandler.cs │ │ │ ├── DeleteInvoiceCommandHandler.cs │ │ │ └── UpdateInvoiceCommandHandler.cs │ │ ├── MusicHandler │ │ │ ├── CreateMusicCommandHandler.cs │ │ │ ├── DeleteMusicCommandHandler.cs │ │ │ └── UpdateMusicCommandHandler.cs │ │ ├── OrderHandler │ │ │ ├── CreateOrderCommandHandler.cs │ │ │ ├── DeleteOrderCommandHandler.cs │ │ │ └── UpdateOrderCommandHandler.cs │ │ ├── ReceiptHandler │ │ │ ├── CreateReceiptCommandHandler.cs │ │ │ ├── DeleteReceiptCommandHandler.cs │ │ │ └── UpdateReceiptCommandHandler.cs │ │ ├── RoleHandler │ │ │ ├── CreateRoleCommandHandler.cs │ │ │ ├── DeleteRoleCommandHandler.cs │ │ │ └── UpdateRoleCommandHandler.cs │ │ ├── SubscriberHandler │ │ │ ├── CreateSubscriberCommandHandler.cs │ │ │ ├── DeleteSubscriberCommandHandler.cs │ │ │ ├── UpdateCreatedSubscriberCommandHandler.cs │ │ │ ├── UpdateSubscriberCommandHandler.cs │ │ │ └── UpdateSubscriberStatusCommandHandler.cs │ │ ├── SubscriptionHandler │ │ │ ├── CreateSubscriptionCommandHandler.cs │ │ │ ├── DeleteSubscriptionCommandHandler.cs │ │ │ └── UpdateSubscriptionCommandHandler.cs │ │ ├── TodoItemHandler │ │ │ ├── CreateTodoItemCommandHandler.cs │ │ │ ├── DeleteTodoItemCommandHandler.cs │ │ │ └── UpdateTodoItemCommandHandler.cs │ │ ├── TodoListHandler │ │ │ ├── CreateTodoListCommandHandler.cs │ │ │ ├── DeleteTodoListCommandHandler.cs │ │ │ └── UpdateTodoListCommandHandler.cs │ │ └── UserHandler │ │ │ ├── ActivateUserCommandHandler.cs │ │ │ ├── AssignUserToRoleCommandHandler.cs │ │ │ ├── CreateUserCommandHandler.cs │ │ │ ├── DeleteUserCommandHandler.cs │ │ │ ├── UpdateUserCommandHandler.cs │ │ │ └── UpdateUserEmailCommandHandler.cs │ └── Queries │ │ ├── CartHandler │ │ ├── GetCartByIdQueryHandler.cs │ │ ├── GetCartsCountQueryHandler.cs │ │ └── GetCartsQueryHandler.cs │ │ ├── ClotheHandler │ │ ├── GetClotheByIdQueryHandler.cs │ │ └── GetClothesQueryHandler.cs │ │ ├── InvoiceHandler │ │ ├── GetInvoiceByIdQueryHandler.cs │ │ └── GetInvoicesQueryHandler.cs │ │ ├── MusicHandler │ │ ├── GetMusicByIdQueryHandler.cs │ │ └── GetMusicsQueryHandler.cs │ │ ├── OrderHandler │ │ ├── GetOrderByIdQueryHandler.cs │ │ └── GetOrdersQueryHandler.cs │ │ ├── ReceiptHandler │ │ ├── GetReceiptByIdQueryHandler.cs │ │ └── GetReceiptsQueryHandler.cs │ │ ├── RoleHandler │ │ ├── GetRoleByIdQueryHandler.cs │ │ ├── GetRoleByNormalizedNameQueryHandler.cs │ │ ├── GetRolesForAdminQueryHandler.cs │ │ └── GetRolesQueryHandler.cs │ │ ├── SubscriberHandler │ │ ├── GetSubscriberByIdQueryHandler.cs │ │ ├── GetSubscribersQueryHandler.cs │ │ └── GetUserSubscribersQueryHandler.cs │ │ ├── SubscriptionHandler │ │ ├── GetSubscriptionByIdQueryHandler.cs │ │ └── GetSubscriptionsQueryHandler.cs │ │ ├── TodoItemHandler │ │ ├── GetTodoItemByIdQueryHandler.cs │ │ └── GetTodoItemsQueryHandler.cs │ │ ├── TodoListHandler │ │ ├── GetTodoListByIdQueryHandler.cs │ │ └── GetTodoListsQueryHandler.cs │ │ └── UserHandler │ │ ├── GetUserByEmailQueryHandler.cs │ │ ├── GetUserByIdQueryHandler.cs │ │ ├── GetUsersInactiveQueryHandler.cs │ │ └── GetUsersQueryHandler.cs ├── Queries │ ├── CartQuery │ │ ├── GetCartByIdQuery.cs │ │ ├── GetCartsCountQuery.cs │ │ └── GetCartsQuery.cs │ ├── ClotheQuery │ │ ├── GetClotheByIdQuery.cs │ │ └── GetClothesQuery.cs │ ├── InvoiceQuery │ │ ├── GetInvoiceByIdQuery.cs │ │ └── GetInvoicesQuery.cs │ ├── MusicQuery │ │ ├── GetMusicByIdQuery.cs │ │ └── GetMusicsQuery.cs │ ├── OrderQuery │ │ ├── GetOrderByIdQuery.cs │ │ └── GetOrdersQuery.cs │ ├── ReceiptQuery │ │ ├── GetReceiptByIdQuery.cs │ │ └── GetReceiptsQuery.cs │ ├── RoleQuery │ │ ├── GetRoleByIdQuery.cs │ │ ├── GetRoleByNormalizedNameQuery.cs │ │ ├── GetRolesForAdminQuery.cs │ │ └── GetRolesQuery.cs │ ├── SubscriberQuery │ │ ├── GetSubscriberByIdQuery.cs │ │ ├── GetSubscribersQuery.cs │ │ └── GetUserSubscribersQuery.cs │ ├── SubscriptionQuery │ │ ├── GetSubscriptionByIdQuery.cs │ │ └── GetSubscriptionsQuery.cs │ ├── TodoItemQuery │ │ ├── GetTodoItemByIdQuery.cs │ │ └── GetTodoItemsQuery.cs │ ├── TodoListQuery │ │ ├── GetTodoListByIdQuery.cs │ │ └── GetTodoListsQuery.cs │ └── UserQuery │ │ ├── GetUserByEmailQuery.cs │ │ ├── GetUserByIdQuery.cs │ │ ├── GetUsersInactiveQuery.cs │ │ └── GetUsersQuery.cs ├── Responses │ ├── CartResponse.cs │ ├── ClotheResponse.cs │ ├── InvoiceResponse.cs │ ├── MusicResponse.cs │ ├── OrderResponse.cs │ ├── ReceiptResponse.cs │ ├── RoleResponse.cs │ ├── SubscriberResponse.cs │ ├── SubscriptionResponse.cs │ ├── TodoItemResponse.cs │ ├── TodoListResponse.cs │ └── UserResponse.cs ├── Utils │ ├── ErrorsManager.cs │ └── StringRoleResources.cs ├── Validators │ ├── AccountValidator │ │ ├── ChangePasswordCommandValidator.cs │ │ ├── LoginCommandValidator.cs │ │ ├── RegisterCommandValidator.cs │ │ └── ResetPasswordCommandValidator.cs │ ├── CartValidator │ │ ├── CreateCartCommandValidator.cs │ │ ├── DeleteAllCartsCommandValidator.cs │ │ ├── DeleteCartCommandValidator.cs │ │ ├── GetCartByIdQueryValidator.cs │ │ ├── GetCartsCountQueryValidator.cs │ │ ├── GetCartsQueryValidator.cs │ │ └── UpdateCartCommandValidator.cs │ ├── ClotheValidator │ │ ├── CreateClotheCommandValidator.cs │ │ ├── DeleteClotheCommandValidator.cs │ │ ├── GetClotheByIdQueryValidator.cs │ │ └── UpdateClotheCommandValidator.cs │ ├── InvoiceValidator │ │ ├── CreateInvoiceCommandValidator.cs │ │ ├── DeleteInvoiceCommandValidator.cs │ │ ├── GetInvoiceByIdQueryValidator.cs │ │ └── UpdateInvoiceCommandValidator.cs │ ├── MusicValidator │ │ ├── CreateMusicCommandValidator.cs │ │ ├── DeleteMusicCommandValidator.cs │ │ ├── GetMusicByIdQueryValidator.cs │ │ └── UpdateMusicCommandValidator.cs │ ├── OrderValidator │ │ ├── CreateOrderCommandValidator.cs │ │ ├── DeleteOrderCommandValidator.cs │ │ ├── GetOrderByIdQueryValidator.cs │ │ ├── GetOrdersQueryValidator.cs │ │ └── UpdateOrderCommandValidator.cs │ ├── ReceiptValidator │ │ ├── CreateReceiptCommandValidator.cs │ │ ├── DeleteReceiptCommandValidator.cs │ │ ├── GetReceiptByIdQueryValidator.cs │ │ ├── GetReceiptsQueryValidator.cs │ │ └── UpdateReceiptCommandValidator.cs │ ├── RoleValidator │ │ ├── CreateRoleCommandValidator.cs │ │ ├── DeleteRoleCommandValidator.cs │ │ ├── GetRoleByIdQueryValidator.cs │ │ ├── GetRoleByNormalizedNameQueryValidator.cs │ │ └── UpdateRoleCommandValidator.cs │ ├── SubscriberValidator │ │ ├── CreateSubscriberCommandValidator.cs │ │ ├── DeleteSubscriberCommandValidator.cs │ │ ├── GetSubscriberByIdQueryValidator.cs │ │ ├── GetUserSubscribersQueryValidator.cs │ │ ├── UpdateCreatedSubscriberCommandValidator.cs │ │ ├── UpdateSubscriberCommandValidator.cs │ │ └── UpdateSubscriberStatusCommandValidator.cs │ ├── SubscriptionValidator │ │ ├── CreateSubscriptionCommandValidator.cs │ │ ├── DeleteSubscriptionCommandValidator.cs │ │ ├── GetSubscriptionByIdQueryValidator.cs │ │ └── UpdateSubscriptionCommandValidator.cs │ ├── TodoItemValidator │ │ ├── CreateTodoItemCommandValidator.cs │ │ ├── DeleteTodoItemCommandValidator.cs │ │ ├── GetTodoItemByIdQueryValidator.cs │ │ └── UpdateTodoItemCommandValidator.cs │ ├── TodoListValidator │ │ ├── CreateTodoListCommandValidator.cs │ │ ├── DeleteTodoListCommandValidator.cs │ │ ├── GetTodoListByIdQueryValidator.cs │ │ └── UpdateTodoListCommandValidator.cs │ └── UserValidator │ │ ├── ActivateUserCommandValidator.cs │ │ ├── AssignUserToRoleCommandValidator.cs │ │ ├── CreateUserCommandValidator.cs │ │ ├── DeleteUserCommandValidator.cs │ │ ├── GetUserByEmailQueryValidator.cs │ │ ├── GetUserByIdQueryValidator.cs │ │ ├── UpdateUserCommandValidator.cs │ │ └── UpdateUserEmailCommandValidator.cs ├── _Imports.cs └── stylecop.json ├── BlazorShop.Domain ├── BlazorShop.Domain.csproj ├── Common │ ├── BaseEvent.cs │ └── EntityBase.cs ├── Entities │ ├── Cart.cs │ ├── Clothe.cs │ ├── Identity │ │ ├── Role.cs │ │ ├── RoleClaim.cs │ │ ├── User.cs │ │ ├── UserClaim.cs │ │ ├── UserLogin.cs │ │ ├── UserRole.cs │ │ └── UserToken.cs │ ├── Invoice.cs │ ├── Music.cs │ ├── Order.cs │ ├── Receipt.cs │ ├── Subscriber.cs │ ├── Subscription.cs │ ├── TodoItem.cs │ └── TodoList.cs ├── Enums │ ├── SubscriptionStatus.cs │ ├── TodoItemPriority.cs │ └── TodoItemState.cs ├── _Imports.cs └── stylecop.json ├── BlazorShop.Infrastructure ├── BlazorShop.Infrastructure.csproj ├── Common │ └── MediatorExtensions.cs ├── DependencyInjection.cs ├── Files │ ├── CsvFileBuilder.cs │ └── Maps │ │ └── TodoItemRecordMap.cs ├── Migrations │ ├── 20220121091524_Migration_1.Designer.cs │ ├── 20220121091524_Migration_1.cs │ ├── 20220121214941_Migration_2.Designer.cs │ ├── 20220121214941_Migration_2.cs │ ├── 20220122071420_Migration_3.Designer.cs │ ├── 20220122071420_Migration_3.cs │ ├── 20220122075417_Migration_4.Designer.cs │ ├── 20220122075417_Migration_4.cs │ ├── 20220122140537_Migration_5.Designer.cs │ ├── 20220122140537_Migration_5.cs │ ├── 20220122183058_Migration_6.Designer.cs │ ├── 20220122183058_Migration_6.cs │ ├── 20220122193511_Migration_7.Designer.cs │ ├── 20220122193511_Migration_7.cs │ ├── 20220123101055_Migration_8.Designer.cs │ ├── 20220123101055_Migration_8.cs │ ├── 20220124072521_Migration_9.Designer.cs │ ├── 20220124072521_Migration_9.cs │ ├── 20220128192523_Migration_10.Designer.cs │ ├── 20220128192523_Migration_10.cs │ ├── 20220129065440_Migration_11.Designer.cs │ ├── 20220129065440_Migration_11.cs │ ├── 20220209210341_Migration-12.Designer.cs │ ├── 20220209210341_Migration-12.cs │ ├── 20220209213040_Migration-13.Designer.cs │ ├── 20220209213040_Migration-13.cs │ └── ApplicationDbContextModelSnapshot.cs ├── Persistence │ ├── ApplicationDbContext.cs │ ├── ApplicationDbContextSeed.cs │ └── Configurations │ │ ├── CartConfiguration.cs │ │ ├── ClotheConfiguration.cs │ │ ├── Identity │ │ ├── RoleClaimConfiguration.cs │ │ ├── RoleConfiguration.cs │ │ ├── UserClaimConfiguration.cs │ │ ├── UserConfiguration.cs │ │ ├── UserLoginConfiguration.cs │ │ ├── UserRoleConfiguration.cs │ │ └── UserTokenConfiguration.cs │ │ ├── InvoiceConfiguration.cs │ │ ├── MusicConfiguration.cs │ │ ├── OrderConfiguration.cs │ │ ├── ReceiptConfiguration.cs │ │ ├── SubscriberConfiguration.cs │ │ ├── SubscriptionConfiguration.cs │ │ ├── TodoItemConfiguration.cs │ │ └── TodoListConfiguration.cs ├── Services │ ├── AccountService.cs │ ├── DateTimeService.cs │ ├── EmailService.cs │ ├── RoleService.cs │ └── UserService.cs ├── Utils │ ├── AdminSeedModel.cs │ └── RolesSeedModel.cs ├── _Imports.cs └── stylecop.json ├── BlazorShop.UnitTests ├── Application │ └── Handlers │ │ ├── Commands │ │ ├── AccountHandler │ │ │ ├── ChangePasswordCommandHandlerTests.cs │ │ │ ├── LoginCommandHandlerTests.cs │ │ │ ├── RegisterCommandHandlerTests.cs │ │ │ └── ResetPasswordCommandHandlerTests.cs │ │ ├── CartHandler │ │ │ ├── CreateCartCommandHandlerTests.cs │ │ │ ├── DeleteAllCartsCommandHandlerTests.cs │ │ │ ├── DeleteCartCommandHandlerTests.cs │ │ │ └── UpdateCartCommandHandlerTests.cs │ │ ├── ClotheHandler │ │ │ ├── CreateClotheCommandHandlerTests.cs │ │ │ ├── DeleteClotheCommandHandlerTests.cs │ │ │ └── UpdateClotheCommandHandlerTests.cs │ │ ├── InvoiceHandler │ │ │ ├── CreateInvoiceCommandHandlerTests.cs │ │ │ ├── DeleteInvoiceCommandHandlerTests.cs │ │ │ └── UpdateInvoiceCommandHandlerTests.cs │ │ ├── MusicHandler │ │ │ ├── CreateMusicCommandHandlerTests.cs │ │ │ ├── DeleteMusicCommandHandlerTests.cs │ │ │ └── UpdateMusicCommandHandlerTests.cs │ │ ├── OrderHandler │ │ │ ├── CreateOrderCommandHandlerTests.cs │ │ │ ├── DeleteOrderCommandHandlerTests.cs │ │ │ └── UpdateOrderCommandHandlerTests.cs │ │ ├── ReceiptHandler │ │ │ ├── CreateReceiptCommandHandlerTests.cs │ │ │ ├── DeleteReceiptCommandHandlerTests.cs │ │ │ └── UpdateReceiptCommandHandlerTests.cs │ │ ├── RoleHandler │ │ │ ├── CreateRoleCommandHandlerTests.cs │ │ │ ├── DeleteRoleCommandHandlerTests.cs │ │ │ └── UpdateRoleCommandHandlerTests.cs │ │ ├── SubscriberHandler │ │ │ ├── CreateSubscriberCommandHandlerTests.cs │ │ │ ├── DeleteSubscriberCommandHandlerTests.cs │ │ │ ├── UpdateCreatedSubscriberCommandHandlerTests.cs │ │ │ ├── UpdateSubscriberCommandHandlerTests.cs │ │ │ └── UpdateSubscriberStatusCommandHandlerTests.cs │ │ ├── SubscriptionHandler │ │ │ ├── CreateSubscriptionCommandHandlerTests.cs │ │ │ ├── DeleteSubscriptionCommandHandlerTests.cs │ │ │ └── UpdateSubscriptionCommandHandlerTests.cs │ │ ├── TodoItemHandler │ │ │ ├── CreateTodoItemCommandHandlerTests.cs │ │ │ ├── DeleteTodoItemCommandHandlerTests.cs │ │ │ └── UpdateTodoItemCommandHandlerTests.cs │ │ ├── TodoListHandler │ │ │ ├── CreateTodoListCommandHandlerTests.cs │ │ │ ├── DeleteTodoListCommandHandlerTests.cs │ │ │ └── UpdateTodoListCommandHandlerTests.cs │ │ └── UserHandler │ │ │ ├── ActivateUserCommandHandlerTests.cs │ │ │ ├── AssignUserToRoleCommandHandlerTests.cs │ │ │ ├── CreateUserCommandHandlerTests.cs │ │ │ ├── DeleteUserCommandHandlerTests.cs │ │ │ ├── UpdateUserCommandHandlerTests.cs │ │ │ └── UpdateUserEmailCommandHandlerTests.cs │ │ └── Queries │ │ ├── CartHandler │ │ ├── GetCartByIdQueryHandlerTests.cs │ │ ├── GetCartsCountQueryHandlerTests.cs │ │ └── GetCartsQueryHandlerTests.cs │ │ ├── ClotheHandler │ │ ├── GetClotheByIdQueryHandlerTests.cs │ │ └── GetClothesQueryHandlerTests.cs │ │ ├── InvoiceHandler │ │ ├── GetInvoiceByIdQueryHandlerTests.cs │ │ └── GetInvoicesQueryHandlerTests.cs │ │ ├── MusicHandler │ │ ├── GetMusicByIdQueryHandlerTests.cs │ │ └── GetMusicsQueryHandlerTests.cs │ │ ├── OrderHandler │ │ ├── GetOrderByIdQueryHandlerTests.cs │ │ └── GetOrdersQueryHandlerTests.cs │ │ ├── ReceiptHandler │ │ ├── GetReceiptByIdQueryHandlerTests.cs │ │ └── GetReceiptsQueryHandlerTests.cs │ │ ├── RoleHandler │ │ ├── GetRoleByIdQueryHandlerTests.cs │ │ ├── GetRoleByNormalizedNameQueryHandlerTests.cs │ │ ├── GetRolesForAdminQueryHandlerTests.cs │ │ └── GetRolesQueryHandlerTests.cs │ │ ├── SubscriberHandler │ │ ├── GetSubscriberByIdQueryHandlerTests.cs │ │ ├── GetSubscribersQueryHandlerTests.cs │ │ └── GetUserSubscribersQueryHandlerTests.cs │ │ ├── SubscriptionHandler │ │ ├── GetSubscriptionByIdQueryHandlerTests.cs │ │ └── GetSubscriptionsQueryHandlerTests.cs │ │ ├── TodoItemHandler │ │ ├── GetTodoItemByIdQueryHandlerTests.cs │ │ └── GetTodoItemsQueryHandlerTests.cs │ │ ├── TodoListHandler │ │ ├── GetTodoListByIdQueryHandlerTests.cs │ │ └── GetTodoListsQueryHandlerTests.cs │ │ └── UserHandler │ │ ├── GetUserByEmailQueryHandlerTests.cs │ │ ├── GetUserByIdQueryHandlerTests.cs │ │ ├── GetUsersInactiveQueryHandlerTests.cs │ │ └── GetUsersQueryHandlerTests.cs ├── BlazorShop.UnitTests.csproj ├── Controllers │ ├── AccountsControllerTests.cs │ ├── ApiBaseControllerTests.cs │ ├── CartsControllerTests.cs │ ├── ClothesControllerTests.cs │ ├── Filters │ │ ├── ApiExceptionFilterAttributeTests.cs │ │ └── JwtTokenMiddlewareTests.cs │ ├── HomeControllerTests.cs │ ├── InvoicesControllerTests.cs │ ├── MusicsControllerTests.cs │ ├── OrdersControllerTests.cs │ ├── PaymentsControllerTests.cs │ ├── ReceiptsControllerTests.cs │ ├── RolesControllerTests.cs │ ├── SubscribersControllerTests.cs │ ├── SubscriptionsControllerTests.cs │ ├── TodoItemsControllerTests.cs │ ├── TodoListsControllerTests.cs │ └── UsersControllerTests.cs ├── Infrastructure │ ├── AccountServiceTests.cs │ ├── CsvFileBuilderTests.cs │ ├── EmailServiceTests.cs │ ├── Persistence │ │ ├── ApplicationDbContextSeedTests.cs │ │ └── ApplicationDbContextTests.cs │ ├── RoleServiceTests.cs │ └── UserServiceTests.cs ├── Utils │ └── IdentityDbContextFixture.cs ├── WebClient │ ├── Auth │ │ ├── AuthStateProviderTests.cs │ │ ├── AuthenticationServiceTests.cs │ │ └── JwtTokenParserTests.cs │ ├── AuthPolicies │ │ ├── AdminRoleHandlerTests.cs │ │ ├── CustomerRoleHandlerTests.cs │ │ ├── DefaultRoleHandlerTests.cs │ │ └── UserRoleHandlerTests.cs │ ├── Interceptor │ │ └── HttpInterceptorServiceTests.cs │ └── Services │ │ ├── AccountServiceTests.cs │ │ ├── CartServiceTests.cs │ │ ├── ClotheServiceTests.cs │ │ ├── MusicServiceTests.cs │ │ ├── OrderServiceTests.cs │ │ ├── ReceiptServiceTests.cs │ │ ├── RoleServiceTests.cs │ │ ├── SessionStorageServiceTests.cs │ │ ├── StripeServiceTests.cs │ │ ├── SubscriberServiceTests.cs │ │ ├── SubscriptionServiceTests.cs │ │ ├── TodoItemServiceTests.cs │ │ ├── TodoListServiceTests.cs │ │ └── UserServiceTests.cs ├── WorkerService │ └── WorkerServiceTests.cs ├── _Imports.cs ├── appsettings.json └── stylecop.json ├── BlazorShop.WebApi ├── BlazorShop.WebApi.csproj ├── Controllers │ ├── AccountsController.cs │ ├── ApiBaseController.cs │ ├── CartsController.cs │ ├── ClothesController.cs │ ├── HomeController.cs │ ├── InvoicesController.cs │ ├── MusicsController.cs │ ├── OidcConfigurationController.cs │ ├── OrdersController.cs │ ├── PaymentsController.cs │ ├── ReceiptsController.cs │ ├── RolesController.cs │ ├── SubscribersController.cs │ ├── SubscriptionsController.cs │ ├── TodoItemsController.cs │ ├── TodoListsController.cs │ └── UsersController.cs ├── Filters │ ├── ApiExceptionFilterAttribute.cs │ └── JwtTokenMiddleware.cs ├── Program.cs ├── Properties │ └── launchSettings.json ├── Services │ └── CurrentUserService.cs ├── Views │ ├── Error.html │ └── Home.html ├── _Imports.cs ├── appsettings.Development.json ├── appsettings.json └── stylecop.json ├── BlazorShop.WebClient ├── App.razor ├── Auth │ ├── AuthStateProvider.cs │ ├── AuthenticationService.cs │ ├── IAuthenticationService.cs │ └── JwtTokenParser.cs ├── AuthPolicies │ ├── AdminRoleHandler.cs │ ├── AdminRoleRequirement.cs │ ├── CustomerRoleHandler.cs │ ├── CustomerRoleRequirement.cs │ ├── DefaultRoleHandler.cs │ ├── DefaultRoleRequirement.cs │ ├── UserRoleHandler.cs │ └── UserRoleRequirement.cs ├── BlazorShop.WebClient.csproj ├── Interceptor │ ├── HttpInterceptorService.cs │ └── HttpResponseException.cs ├── Interfaces │ ├── IAccountService.cs │ ├── ICartService.cs │ ├── IClotheService.cs │ ├── IMusicService.cs │ ├── IOrderService.cs │ ├── IReceiptService.cs │ ├── IRoleService.cs │ ├── IStripeService.cs │ ├── ISubscriberService.cs │ ├── ISubscriptionService.cs │ ├── ITodoItemService.cs │ ├── ITodoListService.cs │ └── IUserService.cs ├── Pages │ ├── Account │ │ ├── Login.razor │ │ ├── Logout.razor │ │ ├── Register.razor │ │ ├── ResetPassword.razor │ │ └── VerifyAuth.razor │ ├── Admin │ │ ├── Clothes │ │ │ ├── AddEditClothe.razor │ │ │ └── Clothes.razor │ │ ├── Musics │ │ │ ├── AddEditMusic.razor │ │ │ └── Musics.razor │ │ ├── Roles │ │ │ ├── AddEditRole.razor │ │ │ └── Roles.razor │ │ ├── Subscribers │ │ │ └── Subscribers.razor │ │ ├── Subscriptions │ │ │ ├── AddEditSubscription.razor │ │ │ └── Subscriptions.razor │ │ ├── Todos │ │ │ ├── Index.razor │ │ │ ├── TodoItems.razor │ │ │ ├── TodoItems.razor.cs │ │ │ ├── TodoItems.razor.css │ │ │ ├── TodoLists.razor │ │ │ ├── TodoLists.razor.cs │ │ │ ├── TodoState.razor │ │ │ └── TodoState.razor.cs │ │ └── Users │ │ │ ├── AddEditUser.razor │ │ │ └── Users.razor │ ├── Cart │ │ └── Cart.razor │ ├── Clothes │ │ ├── ClotheDetails.razor │ │ └── Index.razor │ ├── Index.razor │ ├── Internal │ │ ├── Not-found.razor │ │ ├── Server-error.razor │ │ └── Unauthorized.razor │ ├── Musics │ │ ├── Index.razor │ │ └── MusicDetails.razor │ ├── Orders │ │ ├── MyOrders.razor │ │ ├── OrderSuccess.razor │ │ └── OrderView.razor │ ├── Receipts │ │ └── Receipts.razor │ ├── Subscriptions │ │ ├── MySubscriptions.razor │ │ ├── SubscriptionSuccess.razor │ │ └── UpdateSubscriptionSuccess.razor │ └── User │ │ └── Profile.razor ├── Program.cs ├── Properties │ └── launchSettings.json ├── Services │ ├── AccountService.cs │ ├── CartService.cs │ ├── ClotheService.cs │ ├── MusicService.cs │ ├── OrderService.cs │ ├── ReceiptService.cs │ ├── RoleService.cs │ ├── SessionStorageService.cs │ ├── StripeService.cs │ ├── SubscriberService.cs │ ├── SubscriptionService.cs │ ├── TodoItemService.cs │ ├── TodoListService.cs │ └── UserService.cs ├── Shared │ ├── AppState.razor │ ├── JsInteropConstants.cs │ ├── MainLayout.razor │ ├── MainLayout.razor.css │ ├── NavMenu.razor │ └── NavMenu.razor.css ├── _Imports.cs ├── _Imports.razor ├── stylecop.json └── wwwroot │ ├── appsettings.json │ ├── audio │ └── music_audio.mp3 │ ├── css │ ├── app.css │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ └── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ ├── css │ │ └── open-iconic-bootstrap.min.css │ │ └── fonts │ │ ├── open-iconic.eot │ │ ├── open-iconic.otf │ │ ├── open-iconic.svg │ │ ├── open-iconic.ttf │ │ └── open-iconic.woff │ ├── favicon.ico │ ├── icon-192.png │ ├── images │ ├── basic_subscription.png │ ├── clothes │ │ ├── buy-3.jpg │ │ ├── category-1.jpg │ │ ├── category-2.jpg │ │ ├── product-10.jpg │ │ ├── product-11.jpg │ │ ├── product-12.jpg │ │ ├── product-2.jpg │ │ ├── product-3.jpg │ │ ├── product-4.jpg │ │ ├── product-5.jpg │ │ ├── product-6.jpg │ │ └── product-7.jpg │ ├── enterprise_subscription.jpg │ ├── musics │ │ ├── music-1.jpg │ │ ├── music-2.jpg │ │ ├── music-3.jpg │ │ ├── music-4.jpg │ │ ├── music-5.jpg │ │ └── music-6.jpg │ ├── order.jpg │ ├── orders.png │ ├── pizzas │ │ ├── bacon.jpg │ │ ├── brit.jpg │ │ ├── cheese.jpg │ │ ├── margherita.jpg │ │ ├── meaty.jpg │ │ ├── mushroom.jpg │ │ ├── pepperoni.jpg │ │ └── salad.jpg │ ├── pro_subscription.png │ ├── receipt.png │ ├── receipts.png │ ├── subscriptions.png │ └── user-profile.png │ ├── index.html │ └── scripts │ └── BlazorShop.js ├── BlazorShop.WorkerService ├── BlazorShop.WorkerService.csproj ├── Program.cs ├── Properties │ └── launchSettings.json ├── Worker.cs ├── _Imports.cs ├── appsettings.json └── stylecop.json ├── BlazorShop.sln ├── LICENSE ├── README.md ├── README_ToImplement.txt └── Stripe_WebHook.txt /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.0 2 | jobs: 3 | build: 4 | docker: 5 | - image: mcr.microsoft.com/dotnet/sdk:7.0 6 | steps: 7 | - checkout 8 | - run: 9 | name: Restore packages 10 | command: dotnet restore 11 | - run: 12 | name: Build 13 | command: dotnet build 14 | - run: 15 | name: Run Unit Tests 16 | command: dotnet test 17 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | jobs: 10 | analyze: 11 | name: Analyze 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout repository 15 | uses: actions/checkout@v3 16 | 17 | - name: Set up CodeQL 18 | uses: github/codeql-action/init@v2 19 | with: 20 | languages: 'csharp, javascript' # Adjust based on your project 21 | 22 | - name: Run CodeQL Analysis 23 | uses: github/codeql-action/analyze@v2 24 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. 2 | # 3 | # You can adjust the behavior by modifying this file. 4 | # For more information, see: 5 | # https://github.com/actions/stale 6 | 7 | name: Close inactive issues 8 | on: 9 | schedule: 10 | - cron: "0 0 1 1 *" 11 | 12 | jobs: 13 | close-issues: 14 | runs-on: ubuntu-latest 15 | permissions: 16 | issues: write 17 | pull-requests: write 18 | steps: 19 | - uses: actions/stale@v5 20 | with: 21 | days-before-issue-stale: 30 22 | days-before-issue-close: 14 23 | stale-issue-label: "stale" 24 | stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." 25 | close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." 26 | days-before-pr-stale: -1 27 | days-before-pr-close: -1 28 | repo-token: ${{ secrets.GITHUB_TOKEN }} 29 | -------------------------------------------------------------------------------- /BlazorShop.Application/BlazorShop.Application.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | BlazorShop.Application 8 | BlazorShop.Application 9 | True 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | all 23 | runtime; build; native; contentfiles; analyzers; buildtransitive 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/AccountCommand/ChangePasswordCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.AccountCommand 6 | { 7 | /// 8 | /// A model to change the passwword. 9 | /// 10 | public class ChangePasswordCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | 17 | /// 18 | /// Gets or sets The old password used. 19 | /// 20 | public string? OldPassword { get; set; } 21 | 22 | /// 23 | /// Gets or sets The new password to be used. 24 | /// 25 | public string? NewPassword { get; set; } 26 | 27 | /// 28 | /// Gets or sets The confirmed password to be used. 29 | /// 30 | public string? ConfirmNewPassword { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/AccountCommand/LoginCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.AccountCommand 6 | { 7 | /// 8 | /// A model to login the user. 9 | /// 10 | public class LoginCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string? Email { get; set; } 16 | 17 | /// 18 | /// Gets or sets The password to logged in. 19 | /// 20 | public string? Password { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/AccountCommand/RegisterCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.AccountCommand 6 | { 7 | /// 8 | /// A model to register the user. 9 | /// 10 | public class RegisterCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string? Email { get; set; } 16 | 17 | /// 18 | /// Gets or sets The first name of the user. 19 | /// 20 | public string? FirstName { get; set; } 21 | 22 | /// 23 | /// Gets or sets The last name of the user. 24 | /// 25 | public string? LastName { get; set; } 26 | 27 | /// 28 | /// Gets or sets The role of the user. 29 | /// 30 | public string? RoleName { get; set; } 31 | 32 | /// 33 | /// Gets or sets The password to be used. 34 | /// 35 | public string? Password { get; set; } 36 | 37 | /// 38 | /// Gets or sets The confirmed password to be used. 39 | /// 40 | public string? ConfirmPassword { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/AccountCommand/ResetPasswordCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.AccountCommand 6 | { 7 | /// 8 | /// A model to reset the password. 9 | /// 10 | public class ResetPasswordCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string? Email { get; set; } 16 | 17 | /// 18 | /// Gets or sets The new password to be used. 19 | /// 20 | public string? NewPassword { get; set; } 21 | 22 | /// 23 | /// Gets or sets The new confirmed password to be used. 24 | /// 25 | public string? NewConfirmPassword { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/CartCommand/CreateCartCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.CartCommand 6 | { 7 | /// 8 | /// A model to create a cart. 9 | /// 10 | public class CreateCartCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | 17 | /// 18 | /// Gets or sets The id of the clothe. 19 | /// 20 | public int ClotheId { get; set; } 21 | 22 | /// 23 | /// Gets or sets The name of the cart. 24 | /// 25 | public string? Name { get; set; } 26 | 27 | /// 28 | /// Gets or sets The price of the cart. 29 | /// 30 | public decimal Price { get; set; } 31 | 32 | /// 33 | /// Gets or sets The amount of the cart. 34 | /// 35 | public int Amount { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/CartCommand/DeleteAllCartsCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.CartCommand 6 | { 7 | /// 8 | /// A model to delete all the carts. 9 | /// 10 | public class DeleteAllCartsCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/CartCommand/DeleteCartCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.CartCommand 6 | { 7 | /// 8 | /// A model to delete a cart. 9 | /// 10 | public class DeleteCartCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the cart. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The id of the user. 19 | /// 20 | public int UserId { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/CartCommand/UpdateCartCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.CartCommand 6 | { 7 | /// 8 | /// A model to update a cart. 9 | /// 10 | public class UpdateCartCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the cart. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The id of the user. 19 | /// 20 | public int UserId { get; set; } 21 | 22 | /// 23 | /// Gets or sets The id of the clothe. 24 | /// 25 | public int ClotheId { get; set; } 26 | 27 | /// 28 | /// Gets or sets The name of the cart. 29 | /// 30 | public string? Name { get; set; } 31 | 32 | /// 33 | /// Gets or sets The price of the cart. 34 | /// 35 | public decimal Price { get; set; } 36 | 37 | /// 38 | /// Gets or sets The amount of the cart. 39 | /// 40 | public int Amount { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/ClotheCommand/DeleteClotheCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.ClotheCommand 6 | { 7 | /// 8 | /// A model to delete a clothe. 9 | /// 10 | public class DeleteClotheCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the clothe. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/InvoiceCommand/CreateInvoiceCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.InvoiceCommand 6 | { 7 | /// 8 | /// A model to create an invoice. 9 | /// 10 | public class CreateInvoiceCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string UserEmail { get; set; } 16 | 17 | /// 18 | /// Gets or sets The name of the invoice. 19 | /// 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// Gets or sets The sub total amount of the invoice. 24 | /// 25 | public int AmountSubTotal { get; set; } 26 | 27 | /// 28 | /// Gets or sets The total amount of the invoice. 29 | /// 30 | public int AmountTotal { get; set; } 31 | 32 | /// 33 | /// Gets or sets The quantity of the invoice. 34 | /// 35 | public int Quantity { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/InvoiceCommand/DeleteInvoiceCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.InvoiceCommand 6 | { 7 | /// 8 | /// A model to delete an invoice. 9 | /// 10 | public class DeleteInvoiceCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the invoice. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/InvoiceCommand/UpdateInvoiceCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.InvoiceCommand 6 | { 7 | /// 8 | /// A model to update an invoice. 9 | /// 10 | public class UpdateInvoiceCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the invoice. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The email of the user. 19 | /// 20 | public string UserEmail { get; set; } 21 | 22 | /// 23 | /// Gets or sets The name of the invoice. 24 | /// 25 | public string Name { get; set; } 26 | 27 | /// 28 | /// Gets or sets The sub total amount of the invoice. 29 | /// 30 | public int AmountSubTotal { get; set; } 31 | 32 | /// 33 | /// Gets or sets The total amount of the invoice. 34 | /// 35 | public int AmountTotal { get; set; } 36 | 37 | /// 38 | /// Gets or sets The quantity of the invoice. 39 | /// 40 | public int Quantity { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/MusicCommand/DeleteMusicCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.MusicCommand 6 | { 7 | /// 8 | /// A model to delete a music. 9 | /// 10 | public class DeleteMusicCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the music. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/OrderCommand/CreateOrderCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.OrderCommand 6 | { 7 | /// 8 | /// A model to create an order. 9 | /// 10 | public class CreateOrderCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string UserEmail { get; set; } 16 | 17 | /// 18 | /// Gets or sets The date when the order was placed. 19 | /// 20 | public DateTime OrderDate { get; set; } 21 | 22 | /// 23 | /// Gets or sets The items placed in the current order. 24 | /// 25 | public string LineItems { get; set; } 26 | 27 | /// 28 | /// Gets or sets The total amount of the items from the order. 29 | /// 30 | public int AmountTotal { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/OrderCommand/DeleteOrderCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.OrderCommand 6 | { 7 | /// 8 | /// A model to delete an order. 9 | /// 10 | public class DeleteOrderCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the order. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/OrderCommand/UpdateOrderCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.OrderCommand 6 | { 7 | /// 8 | /// A model to update an order. 9 | /// 10 | public class UpdateOrderCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the order. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The email of the user. 19 | /// 20 | public string UserEmail { get; set; } 21 | 22 | /// 23 | /// Gets or sets The date when the order was placed. 24 | /// 25 | public DateTime OrderDate { get; set; } 26 | 27 | /// 28 | /// Gets or sets The items placed in the current order. 29 | /// 30 | public string LineItems { get; set; } 31 | 32 | /// 33 | /// Gets or sets The total amount of the items from the order. 34 | /// 35 | public int AmountTotal { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/ReceiptCommand/CreateReceiptCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.ReceiptCommand 6 | { 7 | /// 8 | /// A model to create a receipt. 9 | /// 10 | public class CreateReceiptCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string UserEmail { get; set; } 16 | 17 | /// 18 | /// Gets or sets The date when the receipt was generated. 19 | /// 20 | public DateTime ReceiptDate { get; set; } 21 | 22 | /// 23 | /// Gets or sets The name of the receipt. 24 | /// 25 | public string ReceiptName { get; set; } 26 | 27 | /// 28 | /// Gets or sets The url of the receipt. 29 | /// 30 | public string ReceiptUrl { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/ReceiptCommand/DeleteReceiptCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.ReceiptCommand 6 | { 7 | /// 8 | /// A model to delete a receipt. 9 | /// 10 | public class DeleteReceiptCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the receipt. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/ReceiptCommand/UpdateReceiptCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.ReceiptCommand 6 | { 7 | /// 8 | /// A model to update a receipt. 9 | /// 10 | public class UpdateReceiptCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the receipt. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The email of the user. 19 | /// 20 | public string UserEmail { get; set; } 21 | 22 | /// 23 | /// Gets or sets The date when the receipt was generated. 24 | /// 25 | public DateTime ReceiptDate { get; set; } 26 | 27 | /// 28 | /// Gets or sets The name of the receipt. 29 | /// 30 | public string ReceiptName { get; set; } 31 | 32 | /// 33 | /// Gets or sets The url of the receipt. 34 | /// 35 | public string ReceiptUrl { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/RoleCommand/CreateRoleCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.RoleCommand 6 | { 7 | /// 8 | /// A model to create a role. 9 | /// 10 | public class CreateRoleCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The name of the role. 14 | /// 15 | public string? Name { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/RoleCommand/DeleteRoleCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.RoleCommand 6 | { 7 | /// 8 | /// A model to delete a role. 9 | /// 10 | public class DeleteRoleCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the role. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/RoleCommand/UpdateRoleCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.RoleCommand 6 | { 7 | /// 8 | /// A model to update a role. 9 | /// 10 | public class UpdateRoleCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the role. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The name of the role. 19 | /// 20 | public string? Name { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/SubscriberCommand/CreateSubscriberCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.SubscriberCommand 6 | { 7 | /// 8 | /// A model to create a subscriber. 9 | /// 10 | public class CreateSubscriberCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the subscriber. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The started date of the subscriber. 19 | /// 20 | public DateTime DateStart { get; set; } 21 | 22 | /// 23 | /// Gets or sets The date when the current period ends. 24 | /// 25 | public DateTime CurrentPeriodEnd { get; set; } 26 | 27 | /// 28 | /// Gets or sets The customer id. 29 | /// 30 | public int CustomerId { get; set; } 31 | 32 | /// 33 | /// Gets or sets The subscription id. 34 | /// 35 | public int SubscriptionId { get; set; } 36 | 37 | /// 38 | /// Gets or sets The id of the stripe subscription. 39 | /// 40 | public string StripeSubscriptionId { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/SubscriberCommand/DeleteSubscriberCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.SubscriberCommand 6 | { 7 | /// 8 | /// A model to delete a subscriber. 9 | /// 10 | public class DeleteSubscriberCommand : IRequest 11 | { 12 | /// 13 | /// Gets or Sets The id of the subscriber. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/SubscriberCommand/UpdateCreatedSubscriberCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.SubscriberCommand 6 | { 7 | /// 8 | /// A model to update a created subscriber. 9 | /// 10 | public class UpdateCreatedSubscriberCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The date when the current period ends. 14 | /// 15 | public DateTime CurrentPeriodEnd { get; set; } 16 | 17 | /// 18 | /// Gets or sets The date when the current period starts. 19 | /// 20 | public DateTime CurrentPeriodStart { get; set; } 21 | 22 | /// 23 | /// Gets or sets The email of the customer. 24 | /// 25 | public string CustomerEmail { get; set; } 26 | 27 | /// 28 | /// Gets or sets The id of the stripe subscriber subscription. 29 | /// 30 | public string StripeSubscriberSubscriptionId { get; set; } 31 | 32 | /// 33 | /// Gets or sets The url of the invoice. 34 | /// 35 | public string HostedInvoiceUrl { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/SubscriberCommand/UpdateSubscriberStatusCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.SubscriberCommand 6 | { 7 | /// 8 | /// A model to update a subscriber status. 9 | /// 10 | public class UpdateSubscriberStatusCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the stripe subscriber subscription. 14 | /// 15 | public string StripeSubscriberSubscriptionId { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/SubscriptionCommand/DeleteSubscriptionCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.SubscriptionCommand 6 | { 7 | /// 8 | /// A model to delete a subscription. 9 | /// 10 | public class DeleteSubscriptionCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the subscription. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/TodoItemCommand/CreateTodoItemCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.TodoItemCommand 6 | { 7 | /// 8 | /// A model to create an item. 9 | /// 10 | public class CreateTodoItemCommand : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the item. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The id of the list. 19 | /// 20 | public int ListId { get; set; } 21 | 22 | /// 23 | /// Gets or sets The title of the item. 24 | /// 25 | public string? Title { get; set; } 26 | 27 | /// 28 | /// Gets or sets The note of the item. 29 | /// 30 | public string? Note { get; set; } 31 | 32 | /// 33 | /// Gets or sets The priority of the item. 34 | /// 35 | public TodoItemPriority Priority { get; set; } 36 | 37 | /// 38 | /// Gets or sets The state of the item. 39 | /// 40 | public TodoItemState State { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/TodoItemCommand/DeleteTodoItemCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.TodoItemCommand 6 | { 7 | /// 8 | /// A model to delete an item. 9 | /// 10 | public class DeleteTodoItemCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the item. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/TodoItemCommand/UpdateTodoItemCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.TodoItemCommand 6 | { 7 | /// 8 | /// A model to update an item. 9 | /// 10 | public class UpdateTodoItemCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the item. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The title of the item. 19 | /// 20 | public string? Title { get; set; } 21 | 22 | /// 23 | /// Gets or sets The note of the item. 24 | /// 25 | public string? Note { get; set; } 26 | 27 | /// 28 | /// Gets or sets The priority of the item. 29 | /// 30 | public TodoItemPriority Priority { get; set; } 31 | 32 | /// 33 | /// Gets or sets The state of the item. 34 | /// 35 | public TodoItemState State { get; set; } 36 | 37 | /// 38 | /// Gets or sets a value indicating whether the status is completed. 39 | /// 40 | public bool Done { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/TodoListCommand/CreateTodoListCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.TodoListCommand 6 | { 7 | /// 8 | /// A model to create a list. 9 | /// 10 | public class CreateTodoListCommand : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the list. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The title of the list. 19 | /// 20 | public string? Title { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/TodoListCommand/DeleteTodoListCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.TodoListCommand 6 | { 7 | /// 8 | /// A model to delete a list. 9 | /// 10 | public class DeleteTodoListCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the list. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/TodoListCommand/UpdateTodoListCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.TodoListCommand 6 | { 7 | /// 8 | /// A model to update a list. 9 | /// 10 | public class UpdateTodoListCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the list. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The title of the list. 19 | /// 20 | public string? Title { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/UserCommand/ActivateUserCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.UserCommand 6 | { 7 | /// 8 | /// A model to activate an user. 9 | /// 10 | public class ActivateUserCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/UserCommand/AssignUserToRoleCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.UserCommand 6 | { 7 | /// 8 | /// A model to assign an user to role. 9 | /// 10 | public class AssignUserToRoleCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | 17 | /// 18 | /// Gets or sets The id of the role. 19 | /// 20 | public int RoleId { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/UserCommand/CreateUserCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.UserCommand 6 | { 7 | /// 8 | /// A model to create an user. 9 | /// 10 | public class CreateUserCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string? Email { get; set; } 16 | 17 | /// 18 | /// Gets or sets The first name of the user. 19 | /// 20 | public string? FirstName { get; set; } 21 | 22 | /// 23 | /// Gets or sets The last name of the user. 24 | /// 25 | public string? LastName { get; set; } 26 | 27 | /// 28 | /// Gets or sets The role of the user. 29 | /// 30 | public string? Role { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/UserCommand/DeleteUserCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.UserCommand 6 | { 7 | /// 8 | /// A model to delete an user. 9 | /// 10 | public class DeleteUserCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/UserCommand/UpdateUserCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.UserCommand 6 | { 7 | /// 8 | /// A model to update an user. 9 | /// 10 | public class UpdateUserCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The first name of the user. 19 | /// 20 | public string? FirstName { get; set; } 21 | 22 | /// 23 | /// Gets or sets The last name of the user. 24 | /// 25 | public string? LastName { get; set; } 26 | 27 | /// 28 | /// Gets or sets The role of the user. 29 | /// 30 | public string? Role { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Application/Commands/UserCommand/UpdateUserEmailCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Commands.UserCommand 6 | { 7 | /// 8 | /// A model to update the email of the user. 9 | /// 10 | public class UpdateUserEmailCommand : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | 17 | /// 18 | /// Gets or sets The email of the user. 19 | /// 20 | public string? Email { get; set; } 21 | 22 | /// 23 | /// Gets or sets The new email of the user. 24 | /// 25 | public string? NewEmail { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Exceptions/ForbiddenAccessException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Exceptions 6 | { 7 | /// 8 | /// An exception type for forbidden acces. 9 | /// 10 | public class ForbiddenAccessException : Exception 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public ForbiddenAccessException() 16 | : base() 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Interfaces/ICsvFileBuilder.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Interfaces 6 | { 7 | /// 8 | /// A service to provide Csv File features. 9 | /// 10 | public interface ICsvFileBuilder 11 | { 12 | /// 13 | /// Build a file. 14 | /// 15 | /// The data to be converted into file. 16 | /// The request response. 17 | byte[] BuildTodoItemsFile(IEnumerable records); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Interfaces/ICurrentUserService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Interfaces 6 | { 7 | /// 8 | /// A service for current user. 9 | /// 10 | public interface ICurrentUserService 11 | { 12 | /// 13 | /// Gets the user id. 14 | /// 15 | int UserId { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Interfaces/IDateTimeService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Interfaces 6 | { 7 | /// 8 | /// A service for handling the Datetime. 9 | /// 10 | public interface IDateTimeService 11 | { 12 | /// 13 | /// Gets the current Datetime. 14 | /// 15 | DateTime Now { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Interfaces/IEmailService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Interfaces 6 | { 7 | /// 8 | /// A service for handling the emails. 9 | /// 10 | public interface IEmailService 11 | { 12 | /// 13 | /// Sending the emails. 14 | /// 15 | /// The email address where to send the email. 16 | /// The mail body. 17 | /// A representing the result of the asynchronous operation. 18 | Task SendEmail(string? email, EmailSettings mail); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Mappings/IMapFrom.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Mappings 6 | { 7 | /// 8 | /// A custom mapping service. 9 | /// 10 | /// The type of the objects to be mapped from. 11 | public interface IMapFrom 12 | { 13 | /// 14 | /// Converting an object to another type, DAL to BLL. 15 | /// 16 | /// The profile setting to use when mapping objects. 17 | void Mapping(Profile profile) => profile.CreateMap(typeof(T), this.GetType()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Models/EmailSettings.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Models 6 | { 7 | /// 8 | /// A setting model for the Email. 9 | /// 10 | public class EmailSettings 11 | { 12 | /// 13 | /// Gets or sets the host. 14 | /// 15 | public string? Host { get; set; } 16 | 17 | /// 18 | /// Gets or sets the port. 19 | /// 20 | public int Port { get; set; } 21 | 22 | /// 23 | /// Gets or sets the subject. 24 | /// 25 | public string? Subject { get; set; } 26 | 27 | /// 28 | /// Gets or sets the message. 29 | /// 30 | public string? Message { get; set; } 31 | 32 | /// 33 | /// Gets or sets the username. 34 | /// 35 | public string? Username { get; set; } 36 | 37 | /// 38 | /// Gets or sets the password. 39 | /// 40 | public string? Password { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Models/JwtTokenConfig.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Models 6 | { 7 | /// 8 | /// A setting model for the JWT token. 9 | /// 10 | public class JwtTokenConfig 11 | { 12 | /// 13 | /// Gets or sets the JWT secret. 14 | /// 15 | public string? Secret { get; set; } 16 | 17 | /// 18 | /// Gets or sets the JWT issuer. 19 | /// 20 | public string? Issuer { get; set; } 21 | 22 | /// 23 | /// Gets or sets the JWT audience. 24 | /// 25 | public string? Audience { get; set; } 26 | 27 | /// 28 | /// Gets or sets the JWT access token. 29 | /// 30 | public string? AccessToken { get; set; } 31 | 32 | /// 33 | /// Gets or sets the JWT refresh token. 34 | /// 35 | public string? RefreshToken { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Models/Result.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Models 6 | { 7 | /// 8 | /// A generic model to return the results. 9 | /// 10 | /// A generic type. 11 | public class Result 12 | where T : class 13 | { 14 | /// 15 | /// Gets or sets a value indicating whether the request was successfully or not. 16 | /// 17 | public bool Successful { get; set; } = false; 18 | 19 | /// 20 | /// Gets or sets The error message if the request is not successful. 21 | /// 22 | public string? Error { get; set; } = null; 23 | 24 | /// 25 | /// Gets or sets A single item containing the data. 26 | /// 27 | public T? Item { get; set; } = null; 28 | 29 | /// 30 | /// Gets or sets A list of items containing the data. 31 | /// 32 | public List? Items { get; set; } = null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /BlazorShop.Application/Common/Security/AuthorizeAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Common.Security 6 | { 7 | /// 8 | /// Specifies the class this attribute is applied to requires authorization. 9 | /// 10 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] 11 | public class AuthorizeAttribute : Attribute 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public AuthorizeAttribute() 17 | { 18 | } 19 | 20 | /// 21 | /// Gets or sets a comma delimited list of roles that are allowed to access the resource. 22 | /// 23 | public string Roles { get; set; } = string.Empty; 24 | 25 | /// 26 | /// Gets or sets the policy name that determines access to the resource. 27 | /// 28 | public string Policy { get; set; } = string.Empty; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/CartQuery/GetCartByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.CartQuery 6 | { 7 | /// 8 | /// A model to get a cart. 9 | /// 10 | public class GetCartByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the cart. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The id of the user. 19 | /// 20 | public int UserId { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/CartQuery/GetCartsCountQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.CartQuery 6 | { 7 | /// 8 | /// A model to count the carts. 9 | /// 10 | public class GetCartsCountQuery : IRequest 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/CartQuery/GetCartsQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.CartQuery 6 | { 7 | /// 8 | /// A model to get the carts. 9 | /// 10 | public class GetCartsQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/ClotheQuery/GetClotheByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.ClotheQuery 6 | { 7 | /// 8 | /// A model to get the clothe. 9 | /// 10 | public class GetClotheByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the clothe. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/ClotheQuery/GetClothesQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.ClotheQuery 6 | { 7 | /// 8 | /// A model to get the clothes. 9 | /// 10 | public class GetClothesQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/InvoiceQuery/GetInvoiceByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.InvoiceQuery 6 | { 7 | /// 8 | /// A model to get the invoice. 9 | /// 10 | public class GetInvoiceByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the invoice. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/InvoiceQuery/GetInvoicesQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.InvoiceQuery 6 | { 7 | /// 8 | /// A model to get the invoices. 9 | /// 10 | public class GetInvoicesQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/MusicQuery/GetMusicByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.MusicQuery 6 | { 7 | /// 8 | /// A model to get the music. 9 | /// 10 | public class GetMusicByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the music. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/MusicQuery/GetMusicsQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.MusicQuery 6 | { 7 | /// 8 | /// A model to get the musics. 9 | /// 10 | public class GetMusicsQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/OrderQuery/GetOrderByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.OrderQuery 6 | { 7 | /// 8 | /// A model to get the order. 9 | /// 10 | public class GetOrderByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the order. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The email of the user. 19 | /// 20 | public string UserEmail { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/OrderQuery/GetOrdersQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.OrderQuery 6 | { 7 | /// 8 | /// A model to get the orders. 9 | /// 10 | public class GetOrdersQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string UserEmail { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/ReceiptQuery/GetReceiptByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.ReceiptQuery 6 | { 7 | /// 8 | /// A model to get the receipt. 9 | /// 10 | public class GetReceiptByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the receipt. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The email of the user. 19 | /// 20 | public string UserEmail { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/ReceiptQuery/GetReceiptsQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.ReceiptQuery 6 | { 7 | /// 8 | /// A model to get the receipts. 9 | /// 10 | public class GetReceiptsQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string UserEmail { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/RoleQuery/GetRoleByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.RoleQuery 6 | { 7 | /// 8 | /// A model to get the role. 9 | /// 10 | public class GetRoleByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the role. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/RoleQuery/GetRoleByNormalizedNameQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.RoleQuery 6 | { 7 | /// 8 | /// A model to get the normalized role. 9 | /// 10 | public class GetRoleByNormalizedNameQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The normalized name of the role. 14 | /// 15 | public string? NormalizedName { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/RoleQuery/GetRolesForAdminQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.RoleQuery 6 | { 7 | /// 8 | /// A model to get the roles for admin. 9 | /// 10 | public class GetRolesForAdminQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/RoleQuery/GetRolesQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.RoleQuery 6 | { 7 | /// 8 | /// A model to get the roles. 9 | /// 10 | public class GetRolesQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/SubscriberQuery/GetSubscriberByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.SubscriberQuery 6 | { 7 | /// 8 | /// A model to get the subcriber. 9 | /// 10 | public class GetSubscriberByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/SubscriberQuery/GetSubscribersQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.SubscriberQuery 6 | { 7 | /// 8 | /// A model to get the subscribers. 9 | /// 10 | public class GetSubscribersQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/SubscriberQuery/GetUserSubscribersQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.SubscriberQuery 6 | { 7 | /// 8 | /// A model to get the subscribers. 9 | /// 10 | public class GetUserSubscribersQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int UserId { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/SubscriptionQuery/GetSubscriptionByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.SubscriptionQuery 6 | { 7 | /// 8 | /// A model to get the subscription. 9 | /// 10 | public class GetSubscriptionByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the subscription. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/SubscriptionQuery/GetSubscriptionsQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.SubscriptionQuery 6 | { 7 | /// 8 | /// A model to get the subscriptions. 9 | /// 10 | public class GetSubscriptionsQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/TodoItemQuery/GetTodoItemByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.TodoItemQuery 6 | { 7 | /// 8 | /// A model to get the item. 9 | /// 10 | public class GetTodoItemByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets the id of the todo item. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/TodoItemQuery/GetTodoItemsQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.TodoItemQuery 6 | { 7 | /// 8 | /// A model to get the items. 9 | /// 10 | public class GetTodoItemsQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/TodoListQuery/GetTodoListByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.TodoListQuery 6 | { 7 | /// 8 | /// A model to get the list. 9 | /// 10 | public class GetTodoListByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the list. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/TodoListQuery/GetTodoListsQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.TodoListQuery 6 | { 7 | /// 8 | /// A model to get the lists. 9 | /// 10 | public class GetTodoListsQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/UserQuery/GetUserByEmailQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.UserQuery 6 | { 7 | /// 8 | /// A model to get the user. 9 | /// 10 | public class GetUserByEmailQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The email of the user. 14 | /// 15 | public string? Email { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/UserQuery/GetUserByIdQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.UserQuery 6 | { 7 | /// 8 | /// A model to get the user. 9 | /// 10 | public class GetUserByIdQuery : IRequest> 11 | { 12 | /// 13 | /// Gets or sets The id of the user. 14 | /// 15 | public int Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/UserQuery/GetUsersInactiveQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.UserQuery 6 | { 7 | /// 8 | /// A model to get the inactive users. 9 | /// 10 | public class GetUsersInactiveQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Queries/UserQuery/GetUsersQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Queries.UserQuery 6 | { 7 | /// 8 | /// A model to get the users. 9 | /// 10 | public class GetUsersQuery : IRequest> 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Application/Responses/RoleResponse.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Responses 6 | { 7 | /// 8 | /// A Role response model. 9 | /// 10 | public class RoleResponse : IMapFrom 11 | { 12 | /// 13 | /// Gets or sets The id of the role. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The name of the role. 19 | /// 20 | public string? Name { get; set; } 21 | 22 | /// 23 | /// Gets or sets The normalized name of the role. 24 | /// 25 | public string? NormalizedName { get; set; } 26 | 27 | /// 28 | /// Convert the entity (Data Access Layer) to model (Business Logic Layer). 29 | /// 30 | /// The profile to use for the mapping operation. 31 | public void Mapping(Profile profile) 32 | { 33 | profile.CreateMap() 34 | .ForMember(d => d.Id, opt => opt.MapFrom(s => s.Id)) 35 | .ForMember(d => d.Name, opt => opt.MapFrom(s => s.Name)) 36 | .ForMember(d => d.NormalizedName, opt => opt.MapFrom(s => s.NormalizedName)); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /BlazorShop.Application/Responses/TodoListResponse.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Responses 6 | { 7 | /// 8 | /// A TodoList response model. 9 | /// 10 | public class TodoListResponse : IMapFrom 11 | { 12 | /// 13 | /// Gets or sets The id of the list. 14 | /// 15 | public int Id { get; set; } 16 | 17 | /// 18 | /// Gets or sets The title of the list. 19 | /// 20 | public string? Title { get; set; } 21 | 22 | /// 23 | /// Gets or sets The items of the list. 24 | /// 25 | public List Items { get; set; } 26 | 27 | /// 28 | /// Convert the entity (Data Access Layer) to model (Business Logic Layer). 29 | /// 30 | /// The profile to use for the mapping operation. 31 | public void Mapping(Profile profile) 32 | { 33 | profile.CreateMap() 34 | .ForMember(x => x.Id, opt => opt.MapFrom(s => s.Id)) 35 | .ForMember(x => x.Title, opt => opt.MapFrom(s => s.Title)) 36 | .ForMember(x => x.Items, opt => opt.MapFrom(s => s.Items)); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/CartValidator/DeleteAllCartsCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.CartValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteAllCartsCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteAllCartsCommandValidator() 16 | { 17 | this.RuleFor(v => v.UserId) 18 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/CartValidator/DeleteCartCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.CartValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteCartCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteCartCommandValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | 20 | this.RuleFor(v => v.UserId) 21 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/CartValidator/GetCartByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.CartValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetCartByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetCartByIdQueryValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | 20 | this.RuleFor(v => v.UserId) 21 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/CartValidator/GetCartsCountQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.CartValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetCartsCountQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetCartsCountQueryValidator() 16 | { 17 | this.RuleFor(v => v.UserId) 18 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/CartValidator/GetCartsQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.CartValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetCartsQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetCartsQueryValidator() 16 | { 17 | _ = this.RuleFor(v => v.UserId) 18 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/ClotheValidator/DeleteClotheCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.ClotheValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteClotheCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteClotheCommandValidator() 16 | { 17 | _ = this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/ClotheValidator/GetClotheByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.ClotheValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetClotheByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetClotheByIdQueryValidator() 16 | { 17 | _ = this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/InvoiceValidator/DeleteInvoiceCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.InvoiceValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteInvoiceCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteInvoiceCommandValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/InvoiceValidator/GetInvoiceByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.InvoiceValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetInvoiceByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetInvoiceByIdQueryValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/MusicValidator/DeleteMusicCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.MusicValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteMusicCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteMusicCommandValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/MusicValidator/GetMusicByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.MusicValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetMusicByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetMusicByIdQueryValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/OrderValidator/DeleteOrderCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.OrderValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteOrderCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteOrderCommandValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/OrderValidator/GetOrderByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.OrderValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetOrderByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetOrderByIdQueryValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | 20 | this.RuleFor(v => v.UserEmail) 21 | .MaximumLength(100).WithMessage("UserEmail maximum length exceeded") 22 | .NotEmpty().WithMessage("UserEmail must not be empty") 23 | .NotNull().WithMessage("UserEmail must not be null"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/OrderValidator/GetOrdersQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.OrderValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetOrdersQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetOrdersQueryValidator() 16 | { 17 | this.RuleFor(v => v.UserEmail) 18 | .MaximumLength(100).WithMessage("UserEmail maximum length exceeded") 19 | .NotEmpty().WithMessage("UserEmail must not be empty") 20 | .NotNull().WithMessage("UserEmail must not be null"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/ReceiptValidator/DeleteReceiptCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.ReceiptValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteReceiptCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteReceiptCommandValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/ReceiptValidator/GetReceiptByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.ReceiptValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetReceiptByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetReceiptByIdQueryValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | 20 | this.RuleFor(v => v.UserEmail) 21 | .MaximumLength(100).WithMessage("UserEmail maximum length exceeded") 22 | .NotEmpty().WithMessage("UserEmail must not be empty") 23 | .NotNull().WithMessage("UserEmail must not be null"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/ReceiptValidator/GetReceiptsQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.ReceiptValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetReceiptsQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetReceiptsQueryValidator() 16 | { 17 | this.RuleFor(v => v.UserEmail) 18 | .MaximumLength(100).WithMessage("UserEmail maximum length exceeded") 19 | .NotEmpty().WithMessage("UserEmail must not be empty") 20 | .NotNull().WithMessage("UserEmail must not be null"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/RoleValidator/CreateRoleCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.RoleValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class CreateRoleCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public CreateRoleCommandValidator() 16 | { 17 | this.RuleFor(v => v.Name) 18 | .MaximumLength(100).WithMessage("Name maximum length exceeded") 19 | .NotEmpty().WithMessage("Name must not be empty") 20 | .NotNull().WithMessage("Name must not be null"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/RoleValidator/DeleteRoleCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.RoleValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteRoleCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteRoleCommandValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/RoleValidator/GetRoleByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.RoleValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetRoleByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetRoleByIdQueryValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/RoleValidator/GetRoleByNormalizedNameQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.RoleValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetRoleByNormalizedNameQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetRoleByNormalizedNameQueryValidator() 16 | { 17 | this.RuleFor(v => v.NormalizedName) 18 | .MaximumLength(100).WithMessage("NormalizedName maximum length exceeded") 19 | .NotEmpty().WithMessage("NormalizedName must not be empty") 20 | .NotNull().WithMessage("NormalizedName must not be null"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/RoleValidator/UpdateRoleCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.RoleValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class UpdateRoleCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public UpdateRoleCommandValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | 20 | this.RuleFor(v => v.Name) 21 | .MaximumLength(100).WithMessage("Name maximum length exceeded") 22 | .NotEmpty().WithMessage("Name must not be empty") 23 | .NotNull().WithMessage("Name must not be null"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/SubscriberValidator/DeleteSubscriberCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.SubscriberValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteSubscriberCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteSubscriberCommandValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/SubscriberValidator/GetSubscriberByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.SubscriberValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetSubscriberByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetSubscriberByIdQueryValidator() 16 | { 17 | this.RuleFor(x => x.UserId) 18 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/SubscriberValidator/GetUserSubscribersQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.SubscriberValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetUserSubscribersQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetUserSubscribersQueryValidator() 16 | { 17 | this.RuleFor(x => x.UserId) 18 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/SubscriberValidator/UpdateSubscriberStatusCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.SubscriberValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class UpdateSubscriberStatusCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public UpdateSubscriberStatusCommandValidator() 16 | { 17 | this.RuleFor(x => x.StripeSubscriberSubscriptionId) 18 | .MaximumLength(500).WithMessage("StripeSubscriberSubscriptionId maximum length exceeded") 19 | .NotEmpty().WithMessage("StripeSubscriberSubscriptionId must not be empty") 20 | .NotNull().WithMessage("StripeSubscriberSubscriptionId must not be null"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/SubscriptionValidator/DeleteSubscriptionCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.SubscriptionValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteSubscriptionCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteSubscriptionCommandValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/SubscriptionValidator/GetSubscriptionByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.SubscriptionValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetSubscriptionByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetSubscriptionByIdQueryValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/TodoItemValidator/DeleteTodoItemCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.TodoItemValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteTodoItemCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteTodoItemCommandValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/TodoItemValidator/GetTodoItemByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.TodoItemValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetTodoItemByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetTodoItemByIdQueryValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/TodoListValidator/DeleteTodoListCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.TodoListValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteTodoListCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteTodoListCommandValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/TodoListValidator/GetTodoListByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.TodoListValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetTodoListByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetTodoListByIdQueryValidator() 16 | { 17 | this.RuleFor(x => x.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/UserValidator/ActivateUserCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.UserValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class ActivateUserCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public ActivateUserCommandValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/UserValidator/AssignUserToRoleCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.UserValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class AssignUserToRoleCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public AssignUserToRoleCommandValidator() 16 | { 17 | this.RuleFor(v => v.UserId) 18 | .GreaterThan(0).WithMessage("UserId must be greater than 0"); 19 | 20 | this.RuleFor(v => v.RoleId) 21 | .GreaterThan(0).WithMessage("RoleId must be greater than 0"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/UserValidator/DeleteUserCommandValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.UserValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class DeleteUserCommandValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DeleteUserCommandValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/Validators/UserValidator/GetUserByIdQueryValidator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Application.Validators.UserValidator 6 | { 7 | /// 8 | /// An implementation of the . 9 | /// 10 | public class GetUserByIdQueryValidator : AbstractValidator 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public GetUserByIdQueryValidator() 16 | { 17 | this.RuleFor(v => v.Id) 18 | .GreaterThan(0).WithMessage("Id must be greater than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BlazorShop.Application/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | 4 | "settings": { 5 | "orderingRules": { 6 | "usingDirectivesPlacement": "outsideNamespace", 7 | "blankLinesBetweenUsingGroups": "require" 8 | }, 9 | "documentationRules": { 10 | "companyName": "Beniamin Jitca" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Domain/BlazorShop.Domain.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | Library 6 | enable 7 | enable 8 | BlazorShop.Domain 9 | BlazorShop.Domain 10 | True 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | all 22 | runtime; build; native; contentfiles; analyzers; buildtransitive 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Common/BaseEvent.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | using MediatR; 6 | 7 | namespace BlazorShop.Domain.Common 8 | { 9 | /// 10 | /// A base event. 11 | /// 12 | public abstract class BaseEvent : INotification 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Cart.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities 6 | { 7 | /// 8 | /// A template for the entity cart. 9 | /// 10 | public class Cart : EntityBase 11 | { 12 | /// 13 | /// Gets or Sets the name of the cart. 14 | /// 15 | public string? Name { get; set; } 16 | 17 | /// 18 | /// Gets or Sets the price of the cart. 19 | /// 20 | public decimal Price { get; set; } 21 | 22 | /// 23 | /// Gets or Sets the amount of the cart. 24 | /// 25 | public int Amount { get; set; } 26 | 27 | /// 28 | /// Gets or Sets the clothe. 29 | /// 30 | public Clothe? Clothe { get; set; } 31 | 32 | /// 33 | /// Gets or Sets the user. 34 | /// 35 | public User? User { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Identity/Role.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities.Identity 6 | { 7 | /// 8 | /// A template for the entity role. 9 | /// 10 | public class Role : IdentityRole 11 | { 12 | /// 13 | /// Gets or Sets the users. 14 | /// 15 | public virtual ICollection Users { get; set; } 16 | 17 | /// 18 | /// Gets or Sets the users claims. 19 | /// 20 | public virtual ICollection Claims { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Identity/RoleClaim.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities.Identity 6 | { 7 | /// 8 | /// A template for the entity role claim. 9 | /// 10 | public class RoleClaim : IdentityRoleClaim 11 | { 12 | /// 13 | /// Gets or Sets the role. 14 | /// 15 | public virtual Role Role { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Identity/UserClaim.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities.Identity 6 | { 7 | /// 8 | /// A template for the entity user claim. 9 | /// 10 | public class UserClaim : IdentityUserClaim 11 | { 12 | /// 13 | /// Gets or Sets the user. 14 | /// 15 | public virtual User User { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Identity/UserLogin.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities.Identity 6 | { 7 | /// 8 | /// A template for the entity user login. 9 | /// 10 | public class UserLogin : IdentityUserLogin 11 | { 12 | /// 13 | /// Gets or Sets the user. 14 | /// 15 | public virtual User User { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Identity/UserRole.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities.Identity 6 | { 7 | /// 8 | /// A template for the entity user role. 9 | /// 10 | public class UserRole : IdentityUserRole 11 | { 12 | /// 13 | /// Gets or Sets the user. 14 | /// 15 | public virtual User User { get; set; } 16 | 17 | /// 18 | /// Gets or Sets the role. 19 | /// 20 | public virtual Role Role { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Identity/UserToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities.Identity 6 | { 7 | /// 8 | /// A template for the entity user token. 9 | /// 10 | public class UserToken : IdentityUserToken 11 | { 12 | /// 13 | /// Gets or Sets the user. 14 | /// 15 | public virtual User User { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Invoice.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities 6 | { 7 | /// 8 | /// A template for the entity invoice. 9 | /// 10 | public class Invoice : EntityBase 11 | { 12 | /// 13 | /// Gets or Sets the email of the user. 14 | /// 15 | public string UserEmail { get; set; } 16 | 17 | /// 18 | /// Gets or Sets the name of the invoice. 19 | /// 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// Gets or Sets the sub total amount of the invoice. 24 | /// 25 | public int AmountSubTotal { get; set; } 26 | 27 | /// 28 | /// Gets or Sets the total amount of the invoice. 29 | /// 30 | public int AmountTotal { get; set; } 31 | 32 | /// 33 | /// Gets or Sets the quantity of the invoice. 34 | /// 35 | public int Quantity { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Order.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities 6 | { 7 | /// 8 | /// A template for the entity order. 9 | /// 10 | public class Order : EntityBase 11 | { 12 | /// 13 | /// Gets or Sets the email of the user. 14 | /// 15 | public string UserEmail { get; set; } 16 | 17 | /// 18 | /// Gets or Sets the name of the order. 19 | /// 20 | public string OrderName { get; set; } 21 | 22 | /// 23 | /// Gets or Sets the date of the order. 24 | /// 25 | public DateTime OrderDate { get; set; } 26 | 27 | /// 28 | /// Gets or Sets the items of the order. 29 | /// 30 | public string LineItems { get; set; } 31 | 32 | /// 33 | /// Gets or Sets the total amount of the order. 34 | /// 35 | public int AmountTotal { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/Receipt.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities 6 | { 7 | /// 8 | /// A template for the entity receipt. 9 | /// 10 | public class Receipt : EntityBase 11 | { 12 | /// 13 | /// Gets or Sets the email of the user. 14 | /// 15 | public string UserEmail { get; set; } 16 | 17 | /// 18 | /// Gets or Sets the date of the receipt. 19 | /// 20 | public DateTime ReceiptDate { get; set; } 21 | 22 | /// 23 | /// Gets or Sets the name of the receipt. 24 | /// 25 | public string ReceiptName { get; set; } 26 | 27 | /// 28 | /// Gets or Sets the url of the receipt. 29 | /// 30 | public string ReceiptUrl { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/TodoItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities 6 | { 7 | /// 8 | /// A template for the entity todo item. 9 | /// 10 | public class TodoItem : EntityBase 11 | { 12 | /// 13 | /// Gets or sets the title of the todo item. 14 | /// 15 | public string? Title { get; set; } 16 | 17 | /// 18 | /// Gets or sets the note of the todo item. 19 | /// 20 | public string? Note { get; set; } 21 | 22 | /// 23 | /// Gets or sets the priority of the todo item. 24 | /// 25 | public TodoItemPriority Priority { get; set; } 26 | 27 | /// 28 | /// Gets or sets the state of the todo item. 29 | /// 30 | public TodoItemState State { get; set; } 31 | 32 | /// 33 | /// Gets or sets a value indicating whether the status of the todo item. 34 | /// 35 | public bool Done { get; set; } 36 | 37 | /// 38 | /// Gets or sets the list of the todo item. 39 | /// 40 | public TodoList List { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Entities/TodoList.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Entities 6 | { 7 | /// 8 | /// A template for the entity todo list. 9 | /// 10 | public class TodoList : EntityBase 11 | { 12 | /// 13 | /// Gets or sets the title of the todo list. 14 | /// 15 | public string? Title { get; set; } 16 | 17 | /// 18 | /// Gets or sets the items of the todo list. 19 | /// 20 | public virtual ICollection Items { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Enums/SubscriptionStatus.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Enums 6 | { 7 | /// 8 | /// A enumeration for the subscription statuses. 9 | /// 10 | public enum SubscriptionStatus 11 | { 12 | /// 13 | /// The subscription status is Active. 14 | /// 15 | Active, 16 | 17 | /// 18 | /// The subscription status is Inactive. 19 | /// 20 | Inactive, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Enums/TodoItemPriority.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Enums 6 | { 7 | /// 8 | /// A enumeration for the todo item priorities. 9 | /// 10 | public enum TodoItemPriority 11 | { 12 | /// 13 | /// The item priority is None. 14 | /// 15 | None, 16 | 17 | /// 18 | /// The item priority is Low. 19 | /// 20 | Low, 21 | 22 | /// 23 | /// The item priority is Medium. 24 | /// 25 | Medium, 26 | 27 | /// 28 | /// The item priority is High. 29 | /// 30 | High, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Domain/Enums/TodoItemState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Domain.Enums 6 | { 7 | /// 8 | /// A enumeration for the todo item states. 9 | /// 10 | public enum TodoItemState 11 | { 12 | /// 13 | /// The item was not started. 14 | /// 15 | NotStarted, 16 | 17 | /// 18 | /// The item is in progress. 19 | /// 20 | InProgress, 21 | 22 | /// 23 | /// The item was blocked. 24 | /// 25 | Blocked, 26 | 27 | /// 28 | /// The item was completed. 29 | /// 30 | Done, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Domain/_Imports.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | global using BlazorShop.Domain.Common; 6 | global using BlazorShop.Domain.Entities.Identity; 7 | global using BlazorShop.Domain.Enums; 8 | global using Microsoft.AspNetCore.Identity; 9 | -------------------------------------------------------------------------------- /BlazorShop.Domain/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | 4 | "settings": { 5 | "orderingRules": { 6 | "usingDirectivesPlacement": "outsideNamespace", 7 | "blankLinesBetweenUsingGroups": "require" 8 | }, 9 | "documentationRules": { 10 | "companyName": "Beniamin Jitca" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/BlazorShop.Infrastructure.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | BlazorShop.Infrastructure 8 | BlazorShop.Infrastructure 9 | True 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | all 23 | runtime; build; native; contentfiles; analyzers; buildtransitive 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Files/CsvFileBuilder.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | using System.Globalization; 6 | 7 | using BlazorShop.Infrastructure.Files.Maps; 8 | using CsvHelper; 9 | 10 | namespace BlazorShop.Infrastructure.Files 11 | { 12 | /// 13 | /// An implementation of the class. 14 | /// 15 | public class CsvFileBuilder : ICsvFileBuilder 16 | { 17 | /// 18 | public byte[] BuildTodoItemsFile(IEnumerable records) 19 | { 20 | using var memoryStream = new MemoryStream(); 21 | using (var streamWriter = new StreamWriter(memoryStream)) 22 | { 23 | using var csvWriter = new CsvWriter(streamWriter, CultureInfo.InvariantCulture); 24 | 25 | csvWriter.Context.RegisterClassMap(); 26 | csvWriter.WriteRecords(records); 27 | } 28 | 29 | return memoryStream.ToArray(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Files/Maps/TodoItemRecordMap.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | using System.Globalization; 6 | 7 | using CsvHelper.Configuration; 8 | 9 | namespace BlazorShop.Infrastructure.Files.Maps 10 | { 11 | /// 12 | /// A mapping model for files. 13 | /// 14 | public class TodoItemRecordMap : ClassMap 15 | { 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | public TodoItemRecordMap() 20 | { 21 | this.AutoMap(CultureInfo.InvariantCulture); 22 | 23 | // this.Map(m => m.Done).ConvertUsing(c => c.Done ? "Yes" : "No"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Migrations/20220122071420_Migration_3.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable CS1591 3 | 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace BlazorShop.Infrastructure.Migrations 9 | { 10 | public partial class Migration_3 : Migration 11 | { 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.AddColumn( 15 | name: "OrderName", 16 | table: "Orders", 17 | type: "nvarchar(max)", 18 | nullable: false, 19 | defaultValue: ""); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "OrderName", 26 | table: "Orders"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Migrations/20220122075417_Migration_4.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable CS1591 3 | 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace BlazorShop.Infrastructure.Migrations 9 | { 10 | public partial class Migration_4 : Migration 11 | { 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.AddColumn( 15 | name: "UserEmail", 16 | table: "Receipts", 17 | type: "nvarchar(200)", 18 | maxLength: 200, 19 | nullable: false, 20 | defaultValue: ""); 21 | } 22 | 23 | protected override void Down(MigrationBuilder migrationBuilder) 24 | { 25 | migrationBuilder.DropColumn( 26 | name: "UserEmail", 27 | table: "Receipts"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Migrations/20220122140537_Migration_5.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable CS1591 3 | 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace BlazorShop.Infrastructure.Migrations 9 | { 10 | public partial class Migration_5 : Migration 11 | { 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.AddColumn( 15 | name: "StripeSubscriptionId", 16 | table: "Subscriptions", 17 | type: "nvarchar(max)", 18 | nullable: false, 19 | defaultValue: ""); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "StripeSubscriptionId", 26 | table: "Subscriptions"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Migrations/20220122193511_Migration_7.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable CS1591 3 | 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace BlazorShop.Infrastructure.Migrations 9 | { 10 | public partial class Migration_7 : Migration 11 | { 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.AddColumn( 15 | name: "AccessLevel", 16 | table: "Musics", 17 | type: "int", 18 | nullable: false, 19 | defaultValue: 0); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "AccessLevel", 26 | table: "Musics"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Migrations/20220123101055_Migration_8.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable CS1591 3 | 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace BlazorShop.Infrastructure.Migrations 9 | { 10 | public partial class Migration_8 : Migration 11 | { 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.AddColumn( 15 | name: "ImageName", 16 | table: "Subscriptions", 17 | type: "nvarchar(max)", 18 | nullable: false, 19 | defaultValue: ""); 20 | 21 | migrationBuilder.AddColumn( 22 | name: "ImagePath", 23 | table: "Subscriptions", 24 | type: "nvarchar(max)", 25 | nullable: false, 26 | defaultValue: ""); 27 | } 28 | 29 | protected override void Down(MigrationBuilder migrationBuilder) 30 | { 31 | migrationBuilder.DropColumn( 32 | name: "ImageName", 33 | table: "Subscriptions"); 34 | 35 | migrationBuilder.DropColumn( 36 | name: "ImagePath", 37 | table: "Subscriptions"); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Migrations/20220209213040_Migration-13.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable CS1591 3 | 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace BlazorShop.Infrastructure.Migrations 9 | { 10 | public partial class Migration13 : Migration 11 | { 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.AlterColumn( 15 | name: "Note", 16 | table: "TodoItems", 17 | type: "nvarchar(1000)", 18 | maxLength: 1000, 19 | nullable: true, 20 | oldClrType: typeof(string), 21 | oldType: "nvarchar(1000)", 22 | oldMaxLength: 1000); 23 | } 24 | 25 | protected override void Down(MigrationBuilder migrationBuilder) 26 | { 27 | migrationBuilder.AlterColumn( 28 | name: "Note", 29 | table: "TodoItems", 30 | type: "nvarchar(1000)", 31 | maxLength: 1000, 32 | nullable: false, 33 | defaultValue: "", 34 | oldClrType: typeof(string), 35 | oldType: "nvarchar(1000)", 36 | oldMaxLength: 1000, 37 | oldNullable: true); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/CartConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class CartConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("Carts"); 19 | builder.HasKey(x => x.Id); 20 | 21 | builder.Property(t => t.Name) 22 | .HasMaxLength(200) 23 | .IsRequired(); 24 | builder.Property(p => p.Price) 25 | .HasColumnType("decimal(18, 2)") 26 | .IsRequired(); 27 | builder.Property(t => t.Amount) 28 | .IsRequired(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/Identity/RoleClaimConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations.Identity 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class RoleClaimConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("AppRoleClaims"); 19 | 20 | builder.HasOne(roleClaim => roleClaim.Role) 21 | .WithMany(role => role.Claims) 22 | .HasForeignKey(roleClaim => roleClaim.RoleId); 23 | 24 | builder.Property(x => x.ClaimType) 25 | .HasMaxLength(200) 26 | .IsRequired(); 27 | builder.Property(x => x.ClaimValue) 28 | .HasMaxLength(200) 29 | .IsRequired(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/Identity/RoleConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations.Identity 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class RoleConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("AppRoles"); 19 | 20 | builder.Property(x => x.Name) 21 | .HasMaxLength(100) 22 | .IsRequired(); 23 | builder.Property(x => x.NormalizedName) 24 | .HasMaxLength(100) 25 | .IsRequired(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/Identity/UserClaimConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations.Identity 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class UserClaimConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("AppUserClaims"); 19 | 20 | builder.HasOne(userClaim => userClaim.User) 21 | .WithMany(user => user.Claims) 22 | .HasForeignKey(userClaim => userClaim.UserId); 23 | 24 | builder.Property(x => x.ClaimType) 25 | .HasMaxLength(200) 26 | .IsRequired(); 27 | builder.Property(x => x.ClaimValue) 28 | .HasMaxLength(200) 29 | .IsRequired(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/Identity/UserLoginConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations.Identity 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class UserLoginConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("AppUserLogins"); 19 | 20 | builder.HasOne(userLogin => userLogin.User) 21 | .WithMany(user => user.Logins) 22 | .HasForeignKey(userLogin => userLogin.UserId); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/Identity/UserRoleConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations.Identity 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class UserRoleConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("AppUserRoles"); 19 | 20 | builder.HasOne(userRole => userRole.Role) 21 | .WithMany(role => role.Users) 22 | .HasForeignKey(userRole => userRole.RoleId); 23 | builder.HasOne(userRole => userRole.User) 24 | .WithMany(user => user.Roles) 25 | .HasForeignKey(userRole => userRole.UserId); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/Identity/UserTokenConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations.Identity 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class UserTokenConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("AppUserTokens"); 19 | 20 | builder.HasOne(userToken => userToken.User) 21 | .WithMany(user => user.UserTokens) 22 | .HasForeignKey(userToken => userToken.UserId); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/InvoiceConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class InvoiceConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("Invoices"); 19 | builder.HasKey(x => x.Id); 20 | 21 | builder.Property(t => t.UserEmail) 22 | .HasMaxLength(100) 23 | .IsRequired(); 24 | builder.Property(t => t.Name) 25 | .HasMaxLength(200) 26 | .IsRequired(); 27 | builder.Property(t => t.AmountSubTotal) 28 | .IsRequired(); 29 | builder.Property(t => t.AmountTotal) 30 | .IsRequired(); 31 | builder.Property(t => t.Quantity) 32 | .IsRequired(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/OrderConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class OrderConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("Orders"); 19 | builder.HasKey(x => x.Id); 20 | 21 | builder.Property(t => t.UserEmail) 22 | .HasMaxLength(100) 23 | .IsRequired(); 24 | builder.Property(t => t.OrderName) 25 | .HasMaxLength(200) 26 | .IsRequired(); 27 | builder.Property(t => t.OrderDate) 28 | .IsRequired(); 29 | builder.Property(t => t.LineItems) 30 | .HasMaxLength(10000) 31 | .IsRequired(); 32 | builder.Property(t => t.AmountTotal) 33 | .HasMaxLength(50) 34 | .IsRequired(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/ReceiptConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class ReceiptConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("Receipts"); 19 | builder.HasKey(x => x.Id); 20 | 21 | builder.Property(t => t.UserEmail) 22 | .HasMaxLength(100) 23 | .IsRequired(); 24 | builder.Property(t => t.ReceiptDate) 25 | .IsRequired(); 26 | builder.Property(t => t.ReceiptName) 27 | .HasMaxLength(200) 28 | .IsRequired(); 29 | builder.Property(t => t.ReceiptUrl) 30 | .HasMaxLength(500) 31 | .IsRequired(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/TodoItemConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class TodoItemConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("TodoItems"); 19 | builder.HasKey(x => x.Id); 20 | 21 | builder.Property(t => t.Title) 22 | .HasMaxLength(200) 23 | .IsRequired(); 24 | builder.Property(t => t.Note) 25 | .HasMaxLength(1000); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Persistence/Configurations/TodoListConfiguration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Persistence.Configurations 6 | { 7 | /// 8 | /// The configuration for the entity . 9 | /// 10 | public class TodoListConfiguration : IEntityTypeConfiguration 11 | { 12 | /// 13 | /// A method to configure an entity. 14 | /// 15 | /// The builder for configuring the entity metadata. 16 | public void Configure(EntityTypeBuilder builder) 17 | { 18 | builder.ToTable("TodoLists"); 19 | builder.HasKey(x => x.Id); 20 | 21 | builder.Property(t => t.Title) 22 | .HasMaxLength(200) 23 | .IsRequired(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Services/DateTimeService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Services 6 | { 7 | /// 8 | /// An implementation of . 9 | /// 10 | public class DateTimeService : IDateTimeService 11 | { 12 | /// 13 | /// Gets the current time. 14 | /// 15 | public DateTime Now => DateTime.Now; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Utils/AdminSeedModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Utils 6 | { 7 | /// 8 | /// A model of Admin user details. 9 | /// 10 | public class AdminSeedModel 11 | { 12 | /// 13 | /// Gets or Sets the username. 14 | /// 15 | public string? Username { get; set; } 16 | 17 | /// 18 | /// Gets or Sets the firstname. 19 | /// 20 | public string? FirstName { get; set; } 21 | 22 | /// 23 | /// Gets or Sets the lastname. 24 | /// 25 | public string? LastName { get; set; } 26 | 27 | /// 28 | /// Gets or Sets the email. 29 | /// 30 | public string? Email { get; set; } 31 | 32 | /// 33 | /// Gets or Sets the password. 34 | /// 35 | public string? Password { get; set; } 36 | 37 | /// 38 | /// Gets or Sets the role name. 39 | /// 40 | public string? RoleName { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/Utils/RolesSeedModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.Infrastructure.Utils 6 | { 7 | /// 8 | /// A model of Roles seed. 9 | /// 10 | public class RolesSeedModel 11 | { 12 | /// 13 | /// Gets or Sets the admin role name. 14 | /// 15 | public string? AdminRoleName { get; set; } 16 | 17 | /// 18 | /// Gets or Sets the admin normalized role name. 19 | /// 20 | public string? AdminRoleNormalizedName { get; set; } 21 | 22 | /// 23 | /// Gets or Sets the default role name. 24 | /// 25 | public string? DefaultRoleName { get; set; } 26 | 27 | /// 28 | /// Gets or Sets the default normalized role name. 29 | /// 30 | public string? DefaultRoleNormalizedName { get; set; } 31 | 32 | /// 33 | /// Gets or Sets the user role name. 34 | /// 35 | public string? UserRoleName { get; set; } 36 | 37 | /// 38 | /// Gets or Sets the user normalized role name. 39 | /// 40 | public string? UserRoleNormalizedName { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BlazorShop.Infrastructure/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | 4 | "settings": { 5 | "orderingRules": { 6 | "usingDirectivesPlacement": "outsideNamespace", 7 | "blankLinesBetweenUsingGroups": "require" 8 | }, 9 | "documentationRules": { 10 | "companyName": "Beniamin Jitca" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/Controllers/ApiBaseControllerTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.UnitTests.Controllers 6 | { 7 | /// 8 | /// Tests for class. 9 | /// 10 | public class ApiBaseControllerTests 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public ApiBaseControllerTests() 16 | { 17 | } 18 | 19 | /// 20 | /// A test for method. 21 | /// 22 | [Fact] 23 | public void Mediator_Property_Should_Return_IMediator_Instance() 24 | { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/Controllers/Filters/ApiExceptionFilterAttributeTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.UnitTests.Controllers.Filters 6 | { 7 | /// 8 | /// Tests for class. 9 | /// 10 | public class ApiExceptionFilterAttributeTests 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public ApiExceptionFilterAttributeTests() 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/Controllers/Filters/JwtTokenMiddlewareTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.UnitTests.Controllers.Filters 6 | { 7 | /// 8 | /// Tests for class. 9 | /// 10 | public class JwtTokenMiddlewareTests 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public JwtTokenMiddlewareTests() 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/Infrastructure/CsvFileBuilderTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | using BlazorShop.Infrastructure.Files; 6 | 7 | namespace BlazorShop.UnitTests.Infrastructure 8 | { 9 | /// 10 | /// Tests for class. 11 | /// 12 | public class CsvFileBuilderTests 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public CsvFileBuilderTests() 18 | { 19 | this.CsvFileBuilder = new CsvFileBuilder(); 20 | } 21 | 22 | /// 23 | /// Gets the instance of the to use. 24 | /// 25 | private CsvFileBuilder CsvFileBuilder { get; } 26 | 27 | /// 28 | /// A test for method. 29 | /// 30 | /// A representing the result of the asynchronous operation. 31 | [Fact] 32 | public async Task BuildTodoItemsFile() 33 | { 34 | await Task.CompletedTask; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/Infrastructure/Persistence/ApplicationDbContextSeedTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.UnitTests.Infrastructure.Persistence 6 | { 7 | /// 8 | /// Tests for class. 9 | /// 10 | public class ApplicationDbContextSeedTests 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public ApplicationDbContextSeedTests() 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/Infrastructure/Persistence/ApplicationDbContextTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.UnitTests.Infrastructure.Persistence 6 | { 7 | /// 8 | /// Tests for class. 9 | /// 10 | public class ApplicationDbContextTests 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public ApplicationDbContextTests() 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/WebClient/Auth/JwtTokenParserTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.UnitTests.WebClient.Auth 6 | { 7 | /// 8 | /// Tests for class. 9 | /// 10 | public class JwtTokenParserTests 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public JwtTokenParserTests() 16 | { 17 | } 18 | 19 | /// 20 | /// A test for method. 21 | /// 22 | /// A representing the result of the asynchronous operation. 23 | [Fact] 24 | public async Task ParseClaimsFromJwt() 25 | { 26 | await Task.CompletedTask; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "WebApiConnection": "Server=.;Database=BlazorShopDb;Trusted_Connection=True;MultipleActiveResultSets=true;" 4 | }, 5 | 6 | "JwtToken": { 7 | "SecretKey": "!#fDSfdsc47584@?*!", 8 | "Issuer": "https://localhost:5001", 9 | "Audience": "https://localhost:5001", 10 | "AccessTokenExpiration": 20, 11 | "RefreshTokenExpiration": 60 12 | }, 13 | 14 | "AllowedHosts": "*" 15 | } 16 | -------------------------------------------------------------------------------- /BlazorShop.UnitTests/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | // ACTION REQUIRED: This file was automatically added to your project, but it 3 | // will not take effect until additional steps are taken to enable it. See the 4 | // following page for additional information: 5 | // 6 | // https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md 7 | 8 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 9 | 10 | "settings": { 11 | "orderingRules": { 12 | "usingDirectivesPlacement": "outsideNamespace", 13 | "blankLinesBetweenUsingGroups": "require" 14 | }, 15 | "documentationRules": { 16 | "companyName": "Beniamin Jitca" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BlazorShop.WebApi/Controllers/ApiBaseController.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebApi.Controllers 6 | { 7 | /// 8 | /// Controller for setting the Mediator. 9 | /// 10 | [ApiController] 11 | [Route("api/[controller]")] 12 | [Authorize] 13 | public abstract class ApiBaseController : ControllerBase 14 | { 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The instance of the to use. 19 | public ApiBaseController(IMediator mediator) 20 | { 21 | this.Mediator = mediator; 22 | } 23 | 24 | /// 25 | /// Gets the instance of the to use. 26 | /// 27 | protected IMediator Mediator { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BlazorShop.WebApi/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:34877", 7 | "sslPort": 44351 8 | } 9 | }, 10 | "$schema": "http://json.schemastore.org/launchsettings.json", 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": false, 15 | "launchUrl": "api/Home/home", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "WebApi": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | }, 26 | "dotnetRunMessages": "true", 27 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BlazorShop.WebApi/Views/Error.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Erors page 10 | 11 | 12 | -------------------------------------------------------------------------------- /BlazorShop.WebApi/Views/Home.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Index page 10 | 11 | 12 | -------------------------------------------------------------------------------- /BlazorShop.WebApi/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BlazorShop.WebApi/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | 4 | "settings": { 5 | "orderingRules": { 6 | "usingDirectivesPlacement": "outsideNamespace", 7 | "blankLinesBetweenUsingGroups": "require" 8 | }, 9 | "documentationRules": { 10 | "companyName": "Beniamin Jitca" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/App.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | 8 | 9 | 10 | 11 | 12 | Please wait, we are authorizing you. 13 | 14 | 15 | You are not authorized to use this resource. 16 | 17 | 18 | 19 | 20 | 21 | 22 | Not found 23 | 24 |

Sorry, there's nothing at this address.

25 |
26 |
27 |
28 |
29 | 30 |
31 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Auth/IAuthenticationService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.Auth 6 | { 7 | /// 8 | /// A service responsible for the account functionalities. 9 | /// 10 | public interface IAuthenticationService 11 | { 12 | /// 13 | /// Authenticate the user. 14 | /// 15 | /// The login command. 16 | /// A representing the result of the asynchronous operation. 17 | Task Login(LoginCommand userForAuthenticatrion); 18 | 19 | /// 20 | /// Register the user. 21 | /// 22 | /// The register command. 23 | /// A representing the result of the asynchronous operation. 24 | Task Register(RegisterCommand userForAuthenticatrion); 25 | 26 | /// 27 | /// Logout the user from the app. 28 | /// 29 | /// A representing the result of the asynchronous operation. 30 | Task Logout(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/AuthPolicies/AdminRoleHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.AuthPolicies 6 | { 7 | /// 8 | /// Handle the requirement of admin role. 9 | /// 10 | public class AdminRoleHandler : AuthorizationHandler 11 | { 12 | /// 13 | /// Search for the admin role. 14 | /// 15 | /// The instance of the . 16 | /// The instance of the . 17 | /// A representing the result of the asynchronous operation. 18 | protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, AdminRoleRequirement requirement) 19 | { 20 | if (context.User.Identity.IsAuthenticated) 21 | { 22 | var userRole = context.User.Claims.FirstOrDefault(c => c.Type == StringRoleResources.RoleClaim && c.Value == StringRoleResources.Admin); 23 | 24 | if (userRole != null && userRole.Value.Equals(requirement.Role)) 25 | { 26 | context.Succeed(requirement); 27 | } 28 | } 29 | 30 | return Task.CompletedTask; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/AuthPolicies/AdminRoleRequirement.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.AuthPolicies 6 | { 7 | /// 8 | /// A custom policy to check for the Admin role. 9 | /// 10 | public class AdminRoleRequirement : IAuthorizationRequirement 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The role name. 16 | public AdminRoleRequirement(string role) 17 | { 18 | this.Role = role; 19 | } 20 | 21 | /// 22 | /// Gets the role name. 23 | /// 24 | public string Role { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/AuthPolicies/CustomerRoleRequirement.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.AuthPolicies 6 | { 7 | /// 8 | /// A custom policy to check for the Customer role. 9 | /// 10 | public class CustomerRoleRequirement : IAuthorizationRequirement 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public CustomerRoleRequirement() 16 | { 17 | } 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | /// The role name. 23 | public CustomerRoleRequirement(string role) 24 | { 25 | this.Role = role; 26 | } 27 | 28 | /// 29 | /// Gets the role name. 30 | /// 31 | public string Role { get; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/AuthPolicies/DefaultRoleRequirement.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.AuthPolicies 6 | { 7 | /// 8 | /// A custom policy to check for the Default role. 9 | /// 10 | public class DefaultRoleRequirement : IAuthorizationRequirement 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The role name. 16 | public DefaultRoleRequirement(string role) 17 | { 18 | this.Role = role; 19 | } 20 | 21 | /// 22 | /// Gets the role name. 23 | /// 24 | public string Role { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/AuthPolicies/UserRoleHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.AuthPolicies 6 | { 7 | /// 8 | /// Handle the requirement of user role. 9 | /// 10 | public class UserRoleHandler : AuthorizationHandler 11 | { 12 | /// 13 | /// Search for the user role. 14 | /// 15 | /// The instance of the . 16 | /// The instance of the . 17 | /// A representing the result of the asynchronous operation. 18 | protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, UserRoleRequirement requirement) 19 | { 20 | if (context.User.Identity.IsAuthenticated) 21 | { 22 | var userRole = context.User.Claims.FirstOrDefault(c => c.Type == StringRoleResources.RoleClaim && c.Value == StringRoleResources.User); 23 | 24 | if (userRole != null && userRole.Value.Equals(requirement.Role)) 25 | { 26 | context.Succeed(requirement); 27 | } 28 | } 29 | 30 | return Task.CompletedTask; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/AuthPolicies/UserRoleRequirement.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.AuthPolicies 6 | { 7 | /// 8 | /// A custom policy to check for the User role. 9 | /// 10 | public class UserRoleRequirement : IAuthorizationRequirement 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The role name. 16 | public UserRoleRequirement(string role) 17 | { 18 | this.Role = role; 19 | } 20 | 21 | /// 22 | /// Gets the role name. 23 | /// 24 | public string Role { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Interfaces/IAccountService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.Interfaces 6 | { 7 | /// 8 | /// The service to interact with the account. 9 | /// 10 | public interface IAccountService 11 | { 12 | /// 13 | /// Change the password. 14 | /// 15 | /// The command. 16 | /// A representing the result of the asynchronous operation. 17 | Task ChangePassword(ChangePasswordCommand command); 18 | 19 | /// 20 | /// Reset the user password. 21 | /// 22 | /// The command. 23 | /// A representing the result of the asynchronous operation. 24 | Task ResetPassword(ResetPasswordCommand command); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Interfaces/IStripeService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.Interfaces 6 | { 7 | /// 8 | /// The service to interact with the stripe. 9 | /// 10 | public interface IStripeService 11 | { 12 | /// 13 | /// Cancel the membership. 14 | /// 15 | /// The id of the stripe created subscription. 16 | /// A representing the result of the asynchronous operation. 17 | Task CancelMembership(string stripeSubscriptionCreationId); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Pages/Account/Logout.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | @page "/logout" 8 | 9 | @attribute [Authorize] 10 | 11 | @inject NavigationManager NavManager 12 | @inject IAuthenticationService AuthService 13 | 14 | @code { 15 | /// 16 | /// Initialize the component on load. 17 | /// 18 | protected override async Task OnInitializedAsync() 19 | { 20 | await AuthService.Logout(); 21 | NavManager.NavigateTo("/"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Pages/Admin/Todos/Index.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | @page "/admin/todo" 8 | 9 | Todos 10 | 11 |

Todos

12 | 13 |

This component demonstrates ...

14 | 15 | 16 |
17 |
18 | 19 |
20 |
21 | 22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Pages/Admin/Todos/TodoItems.razor.css: -------------------------------------------------------------------------------- 1 | #todo-items .item-input-control { 2 | border: 0; 3 | box-shadow: none; 4 | background-color: transparent; 5 | } 6 | 7 | #todo-items .done-todo { 8 | text-decoration: line-through; 9 | } 10 | 11 | #todo-items .todo-item-title { 12 | padding-top: 8px; 13 | } 14 | 15 | #todo-items .list-group-item { 16 | padding-top: 8px; 17 | padding-bottom: 8px; 18 | } 19 | 20 | #todo-items .list-group-item .btn-xs { 21 | padding: 0; 22 | } 23 | 24 | #todo-items .todo-item-checkbox { 25 | padding-top: 8px; 26 | } 27 | 28 | #todo-items .todo-item-commands { 29 | padding-top: 4px; 30 | } 31 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Pages/Admin/Todos/TodoState.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | 8 | @ChildContent 9 | 10 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Pages/Internal/Not-found.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | @page "/not-found" 8 | 9 | @inject AuthenticationStateProvider AuthStateProvider 10 | @inject IAuthenticationService AuthService 11 | @inject NavigationManager NavManager 12 | 13 |

Not Found

14 | 15 |
16 |

The requested resource was not found....

17 |
18 | 19 | @code { 20 | 21 | /// 22 | /// Initialize the component on load. 23 | /// 24 | protected override async Task OnInitializedAsync() 25 | { 26 | await this.AuthService.Logout(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Pages/Internal/Server-error.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | @page "/server-error" 8 | 9 | @inject AuthenticationStateProvider AuthStateProvider 10 | @inject IAuthenticationService AuthService 11 | @inject NavigationManager NavManager 12 | 13 |

Server Error

14 | 15 |
16 |

Something went wrong, please contact Administrator or try again later...

17 |
18 | 19 | @code { 20 | 21 | /// 22 | /// Initialize the component on load. 23 | /// 24 | protected override async Task OnInitializedAsync() 25 | { 26 | await this.AuthService.Logout(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Pages/Internal/Unauthorized.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | @page "/unauthorized" 8 | 9 | @inject AuthenticationStateProvider AuthStateProvider 10 | @inject IAuthenticationService AuthService 11 | @inject NavigationManager NavManager 12 | 13 |

Unauthorized Request

14 | 15 |
16 |

User is not authorized...

17 |
18 | 19 | @code { 20 | 21 | /// 22 | /// Initialize the component on load. 23 | /// 24 | protected override async Task OnInitializedAsync() 25 | { 26 | await this.AuthService.Logout(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:15337", 7 | "sslPort": 44321 8 | } 9 | }, 10 | "profiles": { 11 | "WebClient": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 16 | "applicationUrl": "https://localhost:7066;http://localhost:5066", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Shared/AppState.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | @inject IJSInProcessRuntime JS 8 | 9 | 10 | @ChildContent 11 | 12 | 13 | @code { 14 | [Parameter] public RenderFragment? ChildContent { get; set; } 15 | 16 | private int _currentCount; 17 | 18 | public int CurrentCount 19 | { 20 | get 21 | { 22 | return _currentCount; 23 | } 24 | set 25 | { 26 | _currentCount = value; 27 | JS.InvokeVoid(JsInteropConstants.SetSessionStorage, nameof(CurrentCount), value); 28 | StateHasChanged(); 29 | } 30 | } 31 | 32 | /// 33 | /// Initialize the component on load. 34 | /// 35 | protected override void OnInitialized() 36 | { 37 | var value = JS.Invoke(JsInteropConstants.GetSessionStorage, nameof(CurrentCount)); 38 | int.TryParse(value, out _currentCount); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Shared/JsInteropConstants.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | namespace BlazorShop.WebClient.Shared 6 | { 7 | /// 8 | /// A runtime JS constants. 9 | /// 10 | public static class JsInteropConstants 11 | { 12 | /// 13 | /// Gets the session storage. 14 | /// 15 | public const string GetSessionStorage = $"{FuncPrefix}.getSessionStorage"; 16 | 17 | /// 18 | /// Sets the session storage. 19 | /// 20 | public const string SetSessionStorage = $"{FuncPrefix}.setSessionStorage"; 21 | 22 | /// 23 | /// The modal name. 24 | /// 25 | public const string HideModal = $"{FuncPrefix}.hideModal"; 26 | 27 | /// 28 | /// The name of the JS runtimes. 29 | /// 30 | private const string FuncPrefix = "BlazorShop"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/_Imports.razor: -------------------------------------------------------------------------------- 1 | @* 2 | 3 | Copyright (c) Beniamin Jitca. All rights reserved. 4 | 5 | *@ 6 | 7 | @using System.Net.Http 8 | @using System.Net.Http.Json 9 | @using Microsoft.AspNetCore.Authorization 10 | @using Microsoft.AspNetCore.Components.Authorization 11 | @using Microsoft.AspNetCore.Components.Forms 12 | @using Microsoft.AspNetCore.Components.Routing 13 | @using Microsoft.AspNetCore.Components.Web 14 | @using Microsoft.AspNetCore.Components.Web.Virtualization 15 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 16 | @using Microsoft.JSInterop 17 | @using BlazorShop.WebClient 18 | @using BlazorShop.WebClient.Shared 19 | @using BlazorShop.WebClient.Auth 20 | @using BlazorShop.Application.Responses 21 | @using BlazorShop.WebClient.Interfaces; 22 | @using BlazorShop.Application.Commands.UserCommand 23 | @using Blazored.Toast 24 | @using Blazored.Toast.Services 25 | @using Blazored.Toast.Configuration 26 | @using System.ComponentModel.DataAnnotations 27 | @using MatBlazor 28 | @using Radzen.Blazor 29 | @using Radzen 30 | @using BlazorShop.Domain.Enums 31 | @using System.Text.RegularExpressions 32 | @using BlazorShop.Application.Utils; 33 | @using FluentValidation 34 | @using Blazored.FluentValidation 35 | @using BlazorShop.Application.Validators.RoleValidator 36 | @using MudBlazor 37 | @using BlazorShop.WebClient.Interceptor; 38 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | 4 | "settings": { 5 | "orderingRules": { 6 | "usingDirectivesPlacement": "outsideNamespace", 7 | "blankLinesBetweenUsingGroups": "require" 8 | }, 9 | "documentationRules": { 10 | "companyName": "Beniamin Jitca" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "JwtToken": { 3 | "SecretKey": "!#fDSfdsc47584@?*!", 4 | "Issuer": "https://localhost:5001", 5 | "Audience": "https://localhost:5001" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/audio/music_audio.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/audio/music_audio.mp3 -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/favicon.ico -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/icon-192.png -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/basic_subscription.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/basic_subscription.png -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/buy-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/buy-3.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/category-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/category-1.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/category-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/category-2.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-10.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-11.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-12.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-2.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-3.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-4.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-5.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-6.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/clothes/product-7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/clothes/product-7.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/enterprise_subscription.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/enterprise_subscription.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/musics/music-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/musics/music-1.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/musics/music-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/musics/music-2.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/musics/music-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/musics/music-3.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/musics/music-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/musics/music-4.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/musics/music-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/musics/music-5.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/musics/music-6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/musics/music-6.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/order.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/order.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/orders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/orders.png -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pizzas/bacon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pizzas/bacon.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pizzas/brit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pizzas/brit.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pizzas/cheese.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pizzas/cheese.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pizzas/margherita.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pizzas/margherita.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pizzas/meaty.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pizzas/meaty.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pizzas/mushroom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pizzas/mushroom.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pizzas/pepperoni.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pizzas/pepperoni.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pizzas/salad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pizzas/salad.jpg -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/pro_subscription.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/pro_subscription.png -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/receipt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/receipt.png -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/receipts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/receipts.png -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/subscriptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/subscriptions.png -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/images/user-profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JBeni/BlazorShop/26a1b08da3e57c1b6500c355a0a1fc61e31bfc7b/BlazorShop.WebClient/wwwroot/images/user-profile.png -------------------------------------------------------------------------------- /BlazorShop.WebClient/wwwroot/scripts/BlazorShop.js: -------------------------------------------------------------------------------- 1 | var BlazorShop = {}; 2 | 3 | BlazorShop.setSessionStorage = function (key, data) { 4 | sessionStorage.setItem(key, data); 5 | } 6 | 7 | BlazorShop.getSessionStorage = function (key) { 8 | return sessionStorage.getItem(key); 9 | } 10 | 11 | BlazorShop.hideModal = function (element) { 12 | bootstrap.Modal.getInstance(element).hide(); 13 | } 14 | -------------------------------------------------------------------------------- /BlazorShop.WorkerService/BlazorShop.WorkerService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | BlazorShop.WorkerService 8 | BlazorShop.WorkerService 9 | dotnet-BlazorShop.WorkerService-DB4A398E-2E65-4CE5-BC68-439078003E8F 10 | True 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | all 22 | runtime; build; native; contentfiles; analyzers; buildtransitive 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /BlazorShop.WorkerService/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | // The configurations for the background worker. 6 | try 7 | { 8 | IHost host = Host.CreateDefaultBuilder(args) 9 | .ConfigureServices((hostContext, services) => 10 | { 11 | IConfiguration configuration = hostContext.Configuration; 12 | 13 | services.AddHttpClient(); 14 | services.AddDbContext(opts => 15 | opts.UseSqlServer( 16 | configuration["ConnectionStrings:WebApiConnection"], 17 | b => b.MigrationsAssembly(typeof(ApplicationDbContext).Assembly.FullName))); 18 | 19 | services.AddHostedService(); 20 | }) 21 | .Build(); 22 | 23 | await host.RunAsync(); 24 | } 25 | catch (Exception ex) 26 | { 27 | Log.Fatal(ex, "Unhandled exception"); 28 | } 29 | -------------------------------------------------------------------------------- /BlazorShop.WorkerService/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "BlazorShop.WorkerService": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": true, 6 | "environmentVariables": { 7 | "DOTNET_ENVIRONMENT": "Development" 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BlazorShop.WorkerService/_Imports.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Beniamin Jitca. All rights reserved. 3 | // 4 | 5 | global using BlazorShop.Domain.Enums; 6 | global using BlazorShop.Infrastructure.Persistence; 7 | global using BlazorShop.WorkerService; 8 | global using Microsoft.EntityFrameworkCore; 9 | global using Serilog; 10 | -------------------------------------------------------------------------------- /BlazorShop.WorkerService/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | }, 8 | 9 | "ConnectionStrings": { 10 | "WebApiConnection": "Server=.;Database=BlazorShopDb;Trusted_Connection=True;MultipleActiveResultSets=true;" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BlazorShop.WorkerService/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | 4 | "settings": { 5 | "orderingRules": { 6 | "usingDirectivesPlacement": "outsideNamespace", 7 | "blankLinesBetweenUsingGroups": "require" 8 | }, 9 | "documentationRules": { 10 | "companyName": "Beniamin Jitca" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Jîtcă Beniamin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README_ToImplement.txt: -------------------------------------------------------------------------------- 1 | 2 | # -> TO DO 3 | 4 | * -> Refresh Token ?! Optional 5 | -------------------------------------------------------------------------------- /Stripe_WebHook.txt: -------------------------------------------------------------------------------- 1 | Using ngrok 2 | 3 | ngrok authtoken 4 | 5 | Then take the url with ssl from web api, run the below command 6 | ngrok http https://localhost:44351 -host-header="localhost:44351" 7 | 8 | Go to stripe dashboard, webhook section and set the endpoint with the value provided at the above step adding /api/Payments/webhook 9 | --------------------------------------------------------------------------------