@@ -21,7 +21,37 @@
Description
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -124,14 +154,16 @@
private async Task OnSubmit()
{
- var sub = SubscriptionRepository.Add(new()
- {
- Name = Model.Name,
- Description = Model.Description
- });
+ var sub = await SubscriptionService.Create(
+ Model.Name,
+ Model.Description,
+ Model.Currency,
+ Model.Price,
+ Model.Duration
+ );
+
+ await SubscriptionService.UpdateLimits(sub, Limits.ToArray());
- await SubscriptionAdminService.SaveLimits(sub, Limits.ToArray());
-
NavigationManager.NavigateTo("/admin/subscriptions");
}
}
\ No newline at end of file
diff --git a/Moonlight/Shared/Views/Domains/Create.razor b/Moonlight/Shared/Views/Domains/Create.razor
index d731acda..e5efd8ea 100644
--- a/Moonlight/Shared/Views/Domains/Create.razor
+++ b/Moonlight/Shared/Views/Domains/Create.razor
@@ -130,12 +130,12 @@
Model = new();
await lazyLoader.SetText(SmartTranslateService.Translate("Loading your subscription"));
- Subscription = await SubscriptionService.GetCurrent();
+ Subscription = await SubscriptionService.GetActiveSubscription(User);
AllowOrder = DomainRepository
.Get()
.Include(x => x.Owner)
- .Count(x => x.Owner.Id == User.Id) < (await SubscriptionService.GetLimit("domains")).Amount;
+ .Count(x => x.Owner.Id == User.Id) < (await SubscriptionService.GetLimit(User, "domains")).Amount;
await lazyLoader.SetText("Loading shared domains");
SharedDomains = SharedDomainRepository.Get().ToArray();
@@ -146,7 +146,7 @@
if (DomainRepository
.Get()
.Include(x => x.Owner)
- .Count(x => x.Owner.Id == User.Id) < (await SubscriptionService.GetLimit("domains")).Amount)
+ .Count(x => x.Owner.Id == User.Id) < (await SubscriptionService.GetLimit(User, "domains")).Amount)
{
var domain = await DomainService.Create(Model.Name, Model.SharedDomain, User);
diff --git a/Moonlight/Shared/Views/Profile/Subscriptions.razor b/Moonlight/Shared/Views/Profile/Subscriptions.razor
deleted file mode 100644
index ed0cb110..00000000
--- a/Moonlight/Shared/Views/Profile/Subscriptions.razor
+++ /dev/null
@@ -1,111 +0,0 @@
-@page "/profile/subscriptions"
-
-@using Moonlight.Shared.Components.Navigations
-@using Moonlight.App.Services
-@using Moonlight.App.Database.Entities
-@using Moonlight.App.Helpers
-@using Moonlight.App.Services.Interop
-
-@inject ConfigService ConfigService
-@inject AlertService AlertService
-@inject SubscriptionService SubscriptionService
-@inject SmartTranslateService SmartTranslateService
-
-
-
-
-
-
-

-
-