예제 #1
0
        /// <summary>
        /// 更新楼宇
        /// </summary>
        /// <param name="buildingUpdateViewModel"></param>
        /// <returns></returns>
        public int Building_Update(BuildingUpdateViewModel buildingUpdateViewModel)
        {
            var BuildingUpdateModel = _IMapper.Map <BuildingUpdateViewModel, Building>(buildingUpdateViewModel);

            _buildingRepository.Update(BuildingUpdateModel);
            return(_buildingRepository.SaveChanges());
        }
        public ActionResult <BuildingUpdateResViewModel> Manage_OpinionInfo_Update(BuildingUpdateViewModel buildingUpdateViewModel)
        {
            int Building_Update_Count;

            Building_Update_Count = _buildingService.Building_Update(buildingUpdateViewModel);
            var opinionInfoUpdateResModel = _buildingFactory.GetBuildingUpdateResViewModel();

            if (Building_Update_Count > 0)
            {
                opinionInfoUpdateResModel.baseViewModel.IsSuccess = true;
                opinionInfoUpdateResModel.AddCount = Building_Update_Count;
                opinionInfoUpdateResModel.baseViewModel.Message      = "更改成功";
                opinionInfoUpdateResModel.baseViewModel.ResponseCode = 200;
                _ILogger.Information("更改楼宇信息成功");
                return(Ok(opinionInfoUpdateResModel));
            }
            else
            {
                opinionInfoUpdateResModel.baseViewModel.IsSuccess = false;
                opinionInfoUpdateResModel.AddCount = 0;
                opinionInfoUpdateResModel.baseViewModel.Message      = "更改失败";
                opinionInfoUpdateResModel.baseViewModel.ResponseCode = 400;
                _ILogger.Information("更改楼宇信息失败");
                return(BadRequest(opinionInfoUpdateResModel));
            }
        }
        public async Task <ValidationResult> Update(BuildingUpdateViewModel buildingViewModel)
        {
            var updateCommand = _mapper.Map <BuildingUpdateCommand>(buildingViewModel);

            return(await(Task <ValidationResult>) Bus.SendCommand(updateCommand));
        }