195 lines
6.9 KiB
C#
195 lines
6.9 KiB
C#
|
|
using CloudBuilder.Core.DatabaseAccessor;
|
|
using CloudBuilder.Core.Policy;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Transactions;
|
|
using CloudBuilder.Core.Service;
|
|
using CloudBuilder.Master.Service;
|
|
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
|
using Microsoft.AspNetCore.Http;
|
|
using CloudBuilder.Master.Entity;
|
|
using System;
|
|
using CloudBuilder.Master.Data;
|
|
using CloudBuilder.Master.SearchCriteria;
|
|
|
|
namespace CloudBuilder.Web.Entry.Controllers.Master
|
|
{
|
|
[Authorize(AuthorizePolicy.PERMISSION)]
|
|
[ApiController]
|
|
[Route("[controller]/[action]")]
|
|
public class PublishVideoController : ControllerBase
|
|
{
|
|
private readonly IApplicationService service;
|
|
private readonly IPublishVideoService publishVideoService;
|
|
|
|
public PublishVideoController(IApplicationService service, IPublishVideoService publishVideoService)
|
|
{
|
|
this.service = service;
|
|
this.publishVideoService= publishVideoService;
|
|
}
|
|
|
|
[PermissionOperate(name: "PublishVideo", operate: "Find")]
|
|
[HttpPost]
|
|
public dynamic FindByKey(string key)
|
|
{
|
|
try
|
|
{
|
|
|
|
var result = publishVideoService.FindByKey(key);
|
|
return result;
|
|
}
|
|
catch (ValidatedException vex)
|
|
{
|
|
return vex;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ServiceErrorException(ex);
|
|
}
|
|
}
|
|
|
|
[PermissionOperate(name: "PublishVideo", operate: "Find")]
|
|
[HttpPost]
|
|
public dynamic FindBySearchCriteria(PublishVideoSearchCriteria criteria)
|
|
{
|
|
try
|
|
{
|
|
|
|
var result = publishVideoService.FindBySearchCriteria(criteria);
|
|
return result;
|
|
}
|
|
catch (ValidatedException vex)
|
|
{
|
|
return vex;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ServiceErrorException(ex);
|
|
}
|
|
}
|
|
|
|
[PermissionOperate(name: "PublishVideo", operate: "Find")]
|
|
[HttpPost]
|
|
public dynamic FindPublishVideoDefault()
|
|
{
|
|
try
|
|
{
|
|
|
|
var result = publishVideoService.FindPublishVideoDefault();
|
|
return result;
|
|
}
|
|
catch (ValidatedException vex)
|
|
{
|
|
return vex;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ServiceErrorException(ex);
|
|
}
|
|
}
|
|
|
|
[PermissionOperate(name: "PublishVideo", operate: "Print")]
|
|
[HttpPost]
|
|
public dynamic PrintBySearchCriteria(PublishVideoSearchCriteria criteria)
|
|
{
|
|
try
|
|
{
|
|
|
|
var result = publishVideoService.PrintBySearchCriteria(criteria);
|
|
return result;
|
|
}
|
|
catch (ValidatedException vex)
|
|
{
|
|
return vex;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ServiceErrorException(ex);
|
|
}
|
|
}
|
|
|
|
[PermissionOperate(name: "PublishVideo", operate: "Insert")]
|
|
[HttpPost]
|
|
[UnitOfWork]
|
|
public dynamic Insert(PublishVideoData data)
|
|
{
|
|
try
|
|
{
|
|
|
|
var result = publishVideoService.Insert(data);
|
|
return result;
|
|
}
|
|
catch (ValidatedException vex)
|
|
{
|
|
return vex;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ServiceErrorException(ex);
|
|
}
|
|
}
|
|
|
|
[PermissionOperate(name: "PublishVideo", operate: "Update")]
|
|
[HttpPost]
|
|
[UnitOfWork]
|
|
public dynamic Update(PublishVideoData data)
|
|
{
|
|
try
|
|
{
|
|
|
|
var result = publishVideoService.Update(data);
|
|
return result;
|
|
}
|
|
catch (ValidatedException vex)
|
|
{
|
|
return vex;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ServiceErrorException(ex);
|
|
}
|
|
}
|
|
|
|
[PermissionOperate(name: "PublishVideo", operate: "Delete")]
|
|
[HttpPost]
|
|
[UnitOfWork]
|
|
public dynamic Delete(string key){
|
|
try
|
|
{
|
|
publishVideoService.Delete(key);
|
|
|
|
return string.Empty;
|
|
}
|
|
catch (ValidatedException vex)
|
|
{
|
|
return vex;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ServiceErrorException(ex);
|
|
}
|
|
}
|
|
|
|
[PermissionOperate(name: "PublishVideo", operate: "Insert")]
|
|
[HttpPost]
|
|
public dynamic InsertPublishVideoDetail(PublishData publishData){
|
|
try
|
|
{
|
|
publishVideoService.InsertPublishVideoDetail(publishData);
|
|
|
|
return string.Empty;
|
|
}
|
|
catch (ValidatedException vex)
|
|
{
|
|
return vex;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ServiceErrorException(ex);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
} |