12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using Bowin.Common.WebModels;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using YLShipBuildLandMap.Entity.ViewModel;
- using YLShipBuildLandMap.Entity.ViewModel.Build;
- using YLShipBuildLandMap.Services.Build;
- namespace YLShipBuildLandMap.Web.Controllers.Build
- {
- [Route("api/build/[controller]/[action]")]
- [Authorize]
- [ApiController]
- public class BuildingController : ControllerBase
- {
- private IBuildingService BuildingService { get; set; }
- public BuildingController(IBuildingService buildingService)
- {
- BuildingService = buildingService;
- }
- [HttpGet]
- public async Task<ResultMessage> GetBuildingList()
- {
- return ResultMessage.Success(await BuildingService.GetBuildingList());
- }
- [HttpGet]
- [AllowAnonymous]
- public async Task<ResultMessage> GetFloorList(Guid? buildingId)
- {
- return ResultMessage.Success(await BuildingService.GetFloorList(buildingId));
- }
- [HttpGet]
- public async Task<ResultMessage> GetBuildingById(Guid? buildingId)
- {
- return ResultMessage.Success(await BuildingService.GetBuildingById(buildingId));
- }
- [HttpPost]
- public async Task<ResultMessage> DeleteBuilding([FromBody] dynamic inputObject)
- {
- List<Guid> idList = inputObject.buildingIds.ToObject<List<Guid>>();
- return ResultMessage.Success(await BuildingService.DeleteBuilding(idList));
- }
- [HttpPost]
- public async Task<ResultMessage> DeleteFloor([FromBody] dynamic inputObject)
- {
- Guid floorId = inputObject.buildingFloorId;
- return ResultMessage.Success(await BuildingService.DeleteFloor(floorId));
- }
- [HttpPost]
- public async Task<ResultMessage> SaveBuilding([FromBody] dynamic inputObj)
- {
- BuildingView data = inputObj["data"].ToObject<BuildingView>();
- List<FloorView> floorList = inputObj["floorList"].ToObject<List<FloorView>>();
- return ResultMessage.Success(await BuildingService.SaveBuilding(data, floorList, LoginUser.Current.UserID));
- }
- [HttpGet]
- [AllowAnonymous]
- public async Task<ResultMessage> GetBuildingXYAxisList(Guid? buildingId)
- {
- return ResultMessage.Success(await BuildingService.GetBuildingXYAxisList(buildingId));
- }
- [HttpGet]
- [AllowAnonymous]
- public async Task<ResultMessage> GetBuildingXyAxisGroupList(Guid? buildingId)
- {
- return ResultMessage.Success(await BuildingService.GetBuildingXyAxisGroupList(buildingId));
- }
- }
- }
|