Example #1
0
        public ActionResult <HouseInfoAddResViewModel> Manage_OpinionInfo_Add(HouseInfoAddViewModel houseInfoAddViewModel)
        {
            int houseInfo_add_Count;

            //查询人员是否已存在

            //添加人员信息
            houseInfo_add_Count = _houseInfoService.AddHouseInfo(houseInfoAddViewModel);
            var opinionInfoAddResModel = _inhabitantFactory.GetHouseInfoAddResViewModel();

            if (houseInfo_add_Count > 0)
            {
                opinionInfoAddResModel.baseViewModel.IsSuccess = true;
                opinionInfoAddResModel.AddCount = houseInfo_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));
            }
        }
Example #2
0
        /// <summary>
        /// 添加房屋信息
        /// </summary>
        /// <param name="houseInfoAddViewModel"></param>
        /// <returns></returns>
        public int AddHouseInfo(HouseInfoAddViewModel houseInfoAddViewModel)
        {
            var tempAddViewMiddle = houseInfoAddViewModel.houseInfoAddMiddles;
            var aAddInsertModel   = _IMapper.Map <List <HouseInfoAddMiddle>, List <HouseInfo> >(tempAddViewMiddle);

            _houseInfoRepository.AddHouseInfo(aAddInsertModel);
            return(_houseInfoRepository.SaveChanges());
        }