public ActionResult <BuildingAddResViewModel> Manage_OpinionInfo_Add(BuildingAddViewModel buildingAddViewModel)
        {
            int Building_add_Count;

            buildingAddViewModel.AddTime = System.DateTime.Now;

            Building_add_Count = _buildingService.AddBuilding(buildingAddViewModel);
            var opinionInfoAddResModel = _buildingFactory.GetBuildingAddResViewModel();

            if (Building_add_Count > 0)
            {
                opinionInfoAddResModel.baseViewModel.IsSuccess = true;
                opinionInfoAddResModel.AddCount = Building_add_Count;
                opinionInfoAddResModel.baseViewModel.Message      = "添加成功";
                opinionInfoAddResModel.baseViewModel.ResponseCode = 200;
                _ILogger.Information("增添楼宇信息成功");
                return(Ok(opinionInfoAddResModel));
            }
            else
            {
                opinionInfoAddResModel.baseViewModel.IsSuccess = false;
                opinionInfoAddResModel.AddCount = 0;
                opinionInfoAddResModel.baseViewModel.Message      = "添加失败";
                opinionInfoAddResModel.baseViewModel.ResponseCode = 400;
                _ILogger.Information("增添楼宇信息失败");
                return(BadRequest(opinionInfoAddResModel));
            }
        }
示例#2
0
        public IActionResult AddBuilding([FromBody] BuildingModel model)
        {
            var buildingEntity = new Building();

            buildingEntity.Name     = model.Name;
            buildingEntity.Location = model.Location;

            _buildingService.AddBuilding(buildingEntity);

            return(Ok());
        }
示例#3
0
 public IActionResult AddBuilding(BuildingModel buildingModel)
 {
     return(Created("", _buildingService.AddBuilding(buildingModel)));
 }
示例#4
0
 public async Task <IActionResult> AddBuilding(AddBuildingDto building)
 {
     return(SetResponse(
                await _buildingService.AddBuilding(building.BuildingName, building.SiteId, building.AreaName)));
 }
 public IActionResult Add([FromBody] Building newBuilding)
 {
     _buildingService.AddBuilding(newBuilding);
     _logger.LogInformation("Building/Object was added.");
     return(Ok(newBuilding));
 }