using System;
using System.Collections.Generic;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.ViewModels;
using IRaCIS.Core.Application.Contracts.RequestAndResponse;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Api.Controllers
{
[Route("sponsor")]
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Institution")]
public class SponsorController : ControllerBase
{
private readonly ISponsorService _sponsorService;
public SponsorController(ISponsorService sponsorService)
{
_sponsorService = sponsorService;
}
/// 分页获取申办方列表
[HttpPost, Route("getSponsorPageList")]
public IResponseOutput> GetSponsorList(SponsorQueryDTO sponsorSearchModel)
{
return ResponseOutput.Ok(_sponsorService.GetSponsorList(sponsorSearchModel));
}
/// 获取所有申办方列表 下拉框
[HttpPost, Route("getAllSponsorList")]
public IResponseOutput> GetSponsorSearchList()
{
return ResponseOutput.Ok(_sponsorService.GetSponsorSearchList());
}
/// 添加或更新申办方信息
[HttpPost, Route("addOrUpdateSponsor")]
public IResponseOutput AddSponsor(SponsorCommand addSponsorViewModel)
{
return _sponsorService.AddOrUpdateSponsor(addSponsorViewModel);
}
/// 删除申办方信息
[HttpDelete, Route("deleteSponsor/{sponsorId:guid}")]
public IResponseOutput DeleteSponsor(Guid sponsorId)
{
return _sponsorService.DeleteSponsor(sponsorId);
}
}
}