display the /HairCut/Brush profile

This commit is contained in:
2018-06-15 15:44:21 +02:00
parent cdc38236e0
commit e85b012184
27 changed files with 516 additions and 364 deletions

View File

@ -7,16 +7,32 @@ namespace Yavsc.Helpers
using Microsoft.Data.Entity;
using Models.Workflow;
using Yavsc.Models;
using Yavsc.Services;
using Yavsc.ViewModels.FrontOffice;
public static class WorkflowHelpers
{
public static List<PerformerProfile> ListPerformers(this ApplicationDbContext context, string actCode)
public static List<PerformerProfileViewModel> ListPerformers(this ApplicationDbContext context,
IBillingService billing,
string actCode)
{
return context.Performers
var settings = billing.GetPerformersSettingsAsync(actCode).Result?.ToArray();
var actors = context.Performers
.Include(p=>p.Activity)
.Include(p=>p.Performer)
.Include(p=>p.Performer.Posts)
.Include(p=>p.Performer.Devices)
.Where(p => p.Active && p.Activity.Any(u=>u.DoesCode==actCode)).OrderBy( x => x.Rate ).ToList();
.Where(p => p.Active && p.Activity.Any(u=>u.DoesCode==actCode)).OrderBy( x => x.Rate )
.ToArray();
List<PerformerProfileViewModel> result = new List<PerformerProfileViewModel> ();
foreach (var perfer in actors)
{
var view = new PerformerProfileViewModel(perfer, actCode, settings?.FirstOrDefault(s => s.UserId == perfer.PerformerId));
result.Add(view);
}
return result;
}
}