booking api: performers
This commit is contained in:
parent
7fdc081899
commit
748e6dd261
2 changed files with 38 additions and 0 deletions
24
Yavsc/ApiControllers/FrontOfficeApiController.cs
Normal file
24
Yavsc/ApiControllers/FrontOfficeApiController.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNet.Mvc;
|
||||||
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Workflow;
|
||||||
|
|
||||||
|
namespace Yavsc.ApiControllers
|
||||||
|
{
|
||||||
|
[Route("api/front")]
|
||||||
|
public class FrontOfficeApiController: Controller
|
||||||
|
{
|
||||||
|
ApplicationDbContext dbContext;
|
||||||
|
public FrontOfficeApiController(ApplicationDbContext context)
|
||||||
|
{
|
||||||
|
dbContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet,Route("Book/{actCode}")]
|
||||||
|
IEnumerable<PerformerProfile> Book (string actCode)
|
||||||
|
{
|
||||||
|
return dbContext.ListPerformers(actCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,11 @@
|
||||||
|
|
||||||
namespace Yavsc.Helpers
|
namespace Yavsc.Helpers
|
||||||
{
|
{
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.Data.Entity;
|
||||||
using Models.Workflow;
|
using Models.Workflow;
|
||||||
|
using Yavsc.Models;
|
||||||
using YavscLib;
|
using YavscLib;
|
||||||
public static class WorkflowHelpers
|
public static class WorkflowHelpers
|
||||||
{
|
{
|
||||||
|
|
@ -12,5 +16,15 @@ namespace Yavsc.Helpers
|
||||||
if (ctor==null) return null;
|
if (ctor==null) return null;
|
||||||
return (ISpecializationSettings) ctor.Invoke(null);
|
return (ISpecializationSettings) ctor.Invoke(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<PerformerProfile> ListPerformers(this ApplicationDbContext context, string actCode)
|
||||||
|
{
|
||||||
|
return 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue