36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
|
9 years ago
|
|
||
|
9 years ago
|
|
||
|
|
namespace Yavsc.Helpers
|
||
|
|
{
|
||
|
9 years ago
|
using System.Collections.Generic;
|
||
|
|
using System.Linq;
|
||
|
3 years ago
|
using Microsoft.EntityFrameworkCore;
|
||
|
9 years ago
|
using Yavsc.Models;
|
||
|
8 years ago
|
using Yavsc.Services;
|
||
|
|
using Yavsc.ViewModels.FrontOffice;
|
||
|
|
|
||
|
9 years ago
|
public static class WorkflowHelpers
|
||
|
|
{
|
||
|
8 years ago
|
public static List<PerformerProfileViewModel> ListPerformers(this ApplicationDbContext context,
|
||
|
|
IBillingService billing,
|
||
|
|
string actCode)
|
||
|
9 years ago
|
{
|
||
|
8 years ago
|
var settings = billing.GetPerformersSettingsAsync(actCode).Result?.ToArray();
|
||
|
|
|
||
|
|
var actors = context.Performers
|
||
|
9 years ago
|
.Include(p=>p.Activity)
|
||
|
|
.Include(p=>p.Performer)
|
||
|
|
.Include(p=>p.Performer.Posts)
|
||
|
7 years ago
|
.Include(p=>p.Performer.DeviceDeclaration)
|
||
|
8 years ago
|
.Where(p => p.Active && p.Activity.Any(u=>u.DoesCode==actCode)).OrderBy( x => x.Rate )
|
||
|
|
.ToArray();
|
||
|
6 years ago
|
List<PerformerProfileViewModel> result = new List<PerformerProfileViewModel> ();
|
||
|
|
result.AddRange(
|
||
|
|
actors.Select(a=> new PerformerProfileViewModel(a, actCode, settings?.FirstOrDefault(s => s.UserId == a.PerformerId))));
|
||
|
8 years ago
|
|
||
|
6 years ago
|
return result;
|
||
|
9 years ago
|
}
|
||
|
9 years ago
|
|
||
|
9 years ago
|
}
|
||
|
9 years ago
|
}
|