//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 2021-11-11 11:04:54
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using IRaCIS.Core.Infra.EFCore;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Contracts
{
///
/// 系统QC 问题管理
///
[ApiExplorerSettings(GroupName = "Image")]
public class QCQuestionConfigureService : BaseService, IQCQuestionService
{
private readonly IRepository _qcQuestionRepository;
public QCQuestionConfigureService(IRepository qcQuestionRepository)
{
_qcQuestionRepository = qcQuestionRepository;
}
[HttpPost]
public async Task> GetQCQuestionConfigureList(QCQuestionQuery queryQCQuestionConfigure)
{
var QCQuestionQueryable = _qcQuestionRepository
.WhereIf(!string.IsNullOrWhiteSpace(queryQCQuestionConfigure.QuestionName), t => t.QuestionName.Contains(queryQCQuestionConfigure.QuestionName))
.WhereIf(!string.IsNullOrWhiteSpace(queryQCQuestionConfigure.Type), t => t.Type.Contains(queryQCQuestionConfigure.Type))
.ProjectTo(_mapper.ConfigurationProvider);
return await QCQuestionQueryable.ToListAsync();
}
public async Task AddOrUpdateQCQuestionConfigure(QCQuestionAddOrEdit addOrEditQCQuestionConfigure)
{
var entity = await _qcQuestionRepository.InsertOrUpdateAsync(addOrEditQCQuestionConfigure, true);
return ResponseOutput.Ok(entity.Id.ToString());
}
[HttpDelete("{qCQuestionConfigureId:guid}")]
public async Task DeleteQCQuestionConfigure(Guid qCQuestionConfigureId)
{
var success = await _qcQuestionRepository.BatchDeleteAsync(t => t.Id == qCQuestionConfigureId);
return ResponseOutput.Result(success);
}
}
}