using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App;
using OpenAuth.App.ServiceApp.BiddingInfoManager;
using OpenAuth.App.ServiceApp.BiddingInfoManager.Request;
using OpenAuth.Repository.Domain;
namespace OpenAuth.WebApi.Controllers.ServiceController
{
///
/// 招标信息
///
[Route("api/[controller]/[action]")]
[ApiController]
public class BiddingInfoController:ControllerBase
{
private readonly BiddingInfoApp _app;
public BiddingInfoController(BiddingInfoApp app)
{
_app = app;
}
///
/// 分页查询招标信息
///
///
///
[HttpGet]
public async Task>>> LoadBiddingInfo([FromQuery]BiddingInfoReq req)
{
var result = new Response>>();
try
{
result = await _app.LoadBiddingInfo(req);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///
/// 根据id查询单个招标信息--编辑招标信息用
///
/// 招标信息id
///
[HttpGet]
public async Task> LoadBiddingInfoById(string id)
{
var result = new Response();
try
{
result = await _app.LoadBiddingInfoById(id);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///
/// 添加招标信息
///
///
///
[HttpPost]
public async Task> AddBiddingInfo(PpBiddinginfo info)
{
var result = new Response();
try
{
result = await _app.AddBiddingInfo(info);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///
/// 编辑招标信息
///
///
///
[HttpPost]
public async Task> EditBiddingInfo(PpBiddinginfo info)
{
var result = new Response();
try
{
result = await _app.EditBiddingInfo(info);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///
/// 删除招标信息
///
///
///
[HttpPost]
public async Task> DeleteBiddingInfo(string id)
{
var result = new Response();
try
{
result = await _app.DeleteBiddingInfo(id);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
#region 招标代理
///
/// 查询招标信息--代理公司的查询,只看自己代理的招标项目
///
///
///
[HttpGet]
public async Task>>> LoadAgencyBiddingInfo([FromQuery] BiddingInfoReq req)
{
var result = new Response>>();
try
{
result = await _app.LoadAgencyBiddingInfo(req);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
#endregion
#region 供应商公司
///
/// 查询招标信息--供应商公司的查询,只看自己报名的招标项目
///
///
///
[HttpGet]
public async Task>>> LoadCompanyBiddingInfo([FromQuery] BiddingInfoReq req)
{
var result = new Response>>();
try
{
result = await _app.LoadCompanyBiddingInfo(req);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
#endregion
///
/// 分页查询招标信息 招商代理--当前招标
///
///
///
[HttpGet]
public async Task>>> LoadAgencyBidding([FromQuery] BiddingInfoReq req)
{
var result = new Response>>();
try
{
result = await _app.LoadAgencyBidding(req);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///
/// 根据招标信息查询报名企业
///
///
///
[HttpGet]
public async Task>> LoadBidCompanyInfo(string bidinfoid)
{
var result = new Response>();
try
{
result = await _app.LoadBidCompanyInfo(bidinfoid);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
}
}