Added first implementation of subscriptions

This commit is contained in:
Marcel Baumgartner
2023-03-03 17:46:23 +01:00
parent 6fe9a0a1bd
commit 2504ebe750
37 changed files with 4291 additions and 84 deletions

View File

@@ -2,11 +2,11 @@
@using Moonlight.App.Repositories
@using Moonlight.App.Repositories.Servers
@using Microsoft.EntityFrameworkCore
@using Moonlight.App.Database.Entities
@using Moonlight.App.Services.Sessions
@inject DatabaseRepository DatabaseRepository
@inject ServerRepository ServerRepository
@inject IdentityService IdentityService
<LazyLoader Load="Load">
<div class="row mb-5">
@@ -222,21 +222,22 @@
@code
{
[CascadingParameter]
public User User { get; set; }
private int DatabaseCount = 0;
private int ServerCount = 0;
private async Task Load(LazyLoader lazyLoader)
{
var user = await IdentityService.Get();
DatabaseCount = DatabaseRepository
.Get()
.Include(x => x.Owner)
.Count(x => x.Owner.Id == user.Id);
.Count(x => x.Owner.Id == User.Id);
ServerCount = ServerRepository
.Get()
.Include(x => x.Owner)
.Count(x => x.Owner.Id == user.Id);
.Count(x => x.Owner.Id == User.Id);
}
}