ow
This commit is contained in:
1 parent
90f26d0dfc
commit
d795476b1f
40 files changed
+2590
No files matched your search
@@ -0,0 +1,155 @@
|
||||
|
||||
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.AI.Service;
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
using CloudBuilder.AI.Entity;
|
||||
using System;
|
||||
using CloudBuilder.AI.Data;
|
||||
using CloudBuilder.AI.SearchCriteria;
|
||||
|
||||
namespace CloudBuilder.Web.Entry.Controllers.Ai
|
||||
{
|
||||
[Authorize(AuthorizePolicy.PERMISSION)]
|
||||
[ApiController]
|
||||
[Route("[controller]/[action]")]
|
||||
public class AiSentenceController : ControllerBase
|
||||
{
|
||||
private readonly IApplicationService service;
|
||||
private readonly IAiSentenceService aiSentenceService;
|
||||
|
||||
public AiSentenceController(IApplicationService service, IAiSentenceService aiSentenceService)
|
||||
{
|
||||
this.service = service;
|
||||
this.aiSentenceService= aiSentenceService;
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindByKey(string key)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = aiSentenceService.FindByKey(key);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Find")]
|
||||
[HttpPost]
|
||||
public dynamic FindBySearchCriteria(AiSentenceSearchCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = aiSentenceService.FindBySearchCriteria(criteria);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Insert")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Insert(AiSentenceEntity data)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = aiSentenceService.Insert(data);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiParagraph", operate: "Insert")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Inserts(AiSentenceEntity[] datas){
|
||||
try
|
||||
{
|
||||
aiSentenceService.Inserts(datas);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Update")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Update(AiSentenceEntity data)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var result = aiSentenceService.Update(data);
|
||||
return result;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[PermissionOperate(name: "AiSentence", operate: "Delete")]
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public dynamic Delete(string key){
|
||||
try
|
||||
{
|
||||
aiSentenceService.Delete(key);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
catch (ValidatedException vex)
|
||||
{
|
||||
return vex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ServiceErrorException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user