56 lines
1.8 KiB
C#
56 lines
1.8 KiB
C#
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("site")]
|
|
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Institution")]
|
|
public class SiteController : ControllerBase
|
|
{
|
|
private readonly ISiteService _siteService;
|
|
|
|
public SiteController(ISiteService siteService)
|
|
{
|
|
_siteService = siteService;
|
|
}
|
|
|
|
/// <summary> 分页获取研究中心列表 </summary>
|
|
|
|
[HttpPost, Route("getSiteList")]
|
|
public IResponseOutput<PageOutput<SiteSelectDTO>> GetSiteList(SiteQueryParam searchModel)
|
|
{
|
|
return ResponseOutput.Ok(_siteService.GetSiteList(searchModel)) ;
|
|
}
|
|
|
|
/// <summary> 获取研究中心列表[New] </summary>
|
|
|
|
[HttpGet, Route("getAllSiteList")]
|
|
public IResponseOutput<IEnumerable<SiteSelectionDTO>> GetAllSiteList()
|
|
{
|
|
return ResponseOutput.Ok(_siteService.GetSiteList()) ;
|
|
}
|
|
|
|
/// <summary> 添加研究中心[AUTH] </summary>
|
|
|
|
[HttpPost, Route("addOrUpdateSite")]
|
|
public IResponseOutput AddOrUpdateSite(SiteCommand addModel)
|
|
{
|
|
var userId = User.FindFirst("id").Value;
|
|
return _siteService.AddOrUpdateSite(addModel, Guid.Parse(userId)) ;
|
|
}
|
|
|
|
/// <summary> 删除研究中心[Auth] </summary>
|
|
|
|
[HttpDelete, Route("deleteSite/{siteId:guid}")]
|
|
public IResponseOutput DeleteResearchCenter(Guid siteId)
|
|
{
|
|
return _siteService.DeleteSite(siteId);
|
|
}
|
|
}
|
|
}
|