30 lines
		
	
	
		
			775 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			775 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using MagicOnion.Server;
 | 
						|
using DysonNetwork.Shared.Services;
 | 
						|
using DysonNetwork.Shared.Models;
 | 
						|
using System;
 | 
						|
using System.Linq;
 | 
						|
using System.Threading.Tasks;
 | 
						|
using Microsoft.EntityFrameworkCore;
 | 
						|
 | 
						|
namespace DysonNetwork.Pass.Developer;
 | 
						|
 | 
						|
public class CustomAppService : ServiceBase<ICustomAppService>, ICustomAppService
 | 
						|
{
 | 
						|
    private readonly AppDatabase _db;
 | 
						|
 | 
						|
    public CustomAppService(AppDatabase db)
 | 
						|
    {
 | 
						|
        _db = db;
 | 
						|
    }
 | 
						|
 | 
						|
    public async Task<CustomApp?> FindClientByIdAsync(Guid clientId)
 | 
						|
    {
 | 
						|
        return await _db.CustomApps.FirstOrDefaultAsync(app => app.Id == clientId);
 | 
						|
    }
 | 
						|
 | 
						|
    public async Task<int> CountCustomAppsByPublisherId(Guid publisherId)
 | 
						|
    {
 | 
						|
        return await _db.CustomApps.CountAsync(app => app.PublisherId == publisherId);
 | 
						|
    }
 | 
						|
}
 |