2018-02-25 03:33:54 +01:00
|
|
|
using System;
|
2017-02-03 15:25:47 +01:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Microsoft.AspNet.Mvc;
|
|
|
|
|
using Yavsc.Helpers;
|
|
|
|
|
using Yavsc.Models;
|
2018-03-26 19:27:29 +02:00
|
|
|
using Yavsc.Services;
|
2018-06-15 15:44:21 +02:00
|
|
|
using Yavsc.ViewModels.FrontOffice;
|
2017-02-03 15:25:47 +01:00
|
|
|
|
|
|
|
|
namespace Yavsc.ApiControllers
|
|
|
|
|
{
|
|
|
|
|
[Route("api/front")]
|
|
|
|
|
public class FrontOfficeApiController: Controller
|
|
|
|
|
{
|
|
|
|
|
ApplicationDbContext dbContext;
|
2018-06-15 15:44:21 +02:00
|
|
|
private IBillingService billing;
|
|
|
|
|
|
|
|
|
|
public FrontOfficeApiController(ApplicationDbContext context, IBillingService billing)
|
2017-02-03 15:25:47 +01:00
|
|
|
{
|
|
|
|
|
dbContext = context;
|
2018-06-15 15:44:21 +02:00
|
|
|
this.billing = billing;
|
2017-02-03 15:25:47 +01:00
|
|
|
}
|
|
|
|
|
|
2018-06-15 15:44:21 +02:00
|
|
|
[HttpGet("profiles/{actCode}")]
|
|
|
|
|
IEnumerable<PerformerProfileViewModel> Profiles (string actCode)
|
2017-02-03 15:25:47 +01:00
|
|
|
{
|
2018-06-15 15:44:21 +02:00
|
|
|
return dbContext.ListPerformers(billing, actCode);
|
2017-02-03 15:25:47 +01:00
|
|
|
}
|
2018-02-25 03:33:54 +01:00
|
|
|
|
2018-06-15 15:44:21 +02:00
|
|
|
[HttpPost("query/reject")]
|
2018-02-25 03:33:54 +01:00
|
|
|
public IActionResult RejectQuery (string billingCode, long queryId)
|
|
|
|
|
{
|
|
|
|
|
if (billingCode==null) return HttpBadRequest("billingCode");
|
|
|
|
|
if (queryId==0) return HttpBadRequest("queryId");
|
2018-03-26 19:27:29 +02:00
|
|
|
var billing = BillingService.GetBillable(dbContext, billingCode, queryId);
|
2018-02-25 03:33:54 +01:00
|
|
|
if (billing==null) return HttpBadRequest();
|
|
|
|
|
billing.Rejected = true;
|
|
|
|
|
billing.RejectedAt = DateTime.Now;
|
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
|
return Ok();
|
|
|
|
|
}
|
2017-02-03 15:25:47 +01:00
|
|
|
}
|
2017-02-17 18:18:42 +01:00
|
|
|
}
|