using System.Collections.Generic;
using System.Threading.Tasks;
using GxPress.Entity.WorkMeeting;
using GxPress.Repository.Interface.WorkMeeting;
using GxPress.Request.Admin.WorkMeeting;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace GxPress.Api.AdminControllers
{
///
/// 会议
///
[Route("api/admin/meeting")]
[ApiController]
[Authorize]
public class AdminMeetingController : ControllerBase
{
private readonly IMeetingLocationRepository _meetingLocationRepository;
private readonly IMeetingOrderRepository _meetingOrderRepository;
private readonly IMeetingRepository _meetingRepository;
private readonly IMeetingRoomRepository _meetingRoomRepository;
private readonly IMeetingSummaryRepository _meetingSummaryRepository;
public AdminMeetingController(IMeetingLocationRepository meetingLocationRepository, IMeetingOrderRepository meetingOrderRepository, IMeetingRepository meetingRepository, IMeetingRoomRepository meetingRoomRepository, IMeetingSummaryRepository meetingSummaryRepository)
{
_meetingLocationRepository = meetingLocationRepository;
_meetingOrderRepository = meetingOrderRepository;
_meetingRepository = meetingRepository;
_meetingRoomRepository = meetingRoomRepository;
_meetingSummaryRepository = meetingSummaryRepository;
}
///
/// 新增会议地点
///
///
///
[HttpPost("location")]
public async Task LocationAdd([FromBody] MeetingLocation request)
{
request.Id = await _meetingLocationRepository.InsertAsync(request);
return request;
}
///
/// 修改会议地点
///
///
///
[HttpPut("location")]
public async Task LocationEdit([FromBody] MeetingLocation request)
{
await _meetingLocationRepository.UpdateAsync(request);
}
///
/// 获取会议地点列表
///
///
[HttpGet("location")]
public async Task> LocationList()
{
return await _meetingLocationRepository.GetListAsync();
}
///
/// 删除会议地点
///
///
[HttpDelete("location/{id}")]
public async Task LocationRemove([FromRoute]int id)
{
return await _meetingLocationRepository.DeleteAsync(id);
}
///
/// 新增会议室
///
///
///
[HttpPost("room")]
public async Task RoomAdd([FromBody] MeetingRoom request)
{
request.Id = await _meetingRoomRepository.InsertAsync(request);
return request;
}
///
/// 修改会议室
///
///
///
[HttpPut("room")]
public async Task RoomEdit([FromBody] MeetingRoom request)
{
await _meetingRoomRepository.UpdateAsync(request);
}
///
/// 获取会议地点列表
///
///
[HttpGet("room")]
public async Task> RoomList([FromQuery] MeetingRoomRequest request)
{
return await _meetingRoomRepository.GetListAsync(request.LocationId);
}
///
/// 删除会议地点
///
///
[HttpDelete("room/{id}")]
public async Task RoomRemove([FromRoute]int id)
{
return await _meetingRoomRepository.DeleteAsync(id);
}
}
}