Exemplo n.º 1
0
        /// <summary>
        /// 修改房源
        /// </summary>
        /// <param name="input"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task ModifyHomeDetail(HouseInput input, Guid id)
        {
            var mhome       = _homeListRepository.FirstOrDefault(a => a.Id == id);
            var mhouseInfo  = _houseInformationRepository.FirstOrDefault(a => a.HomeListId == id);
            var mOwner      = _ownerInforRepository.FirstOrDefault(a => a.HomeListId == id);
            var houseDetail = ObjectMapper.Map <HouseInput, HomeList>(input, mhome);
            //houseDetail.Housecode = query.Housecode - 0 + 1;

            var houseInf = ObjectMapper.Map <HomeInf, HouseInformation>(input.homeInfs, mhouseInfo);

            if (houseInf.Price != 0)
            {
                houseInf.CenterPrice = houseInf.Price / mhome.BuildArea;
            }
            if (houseInf.RecentMoney != 0)
            {
                houseInf.MonthRecentMoney = houseInf.RecentMoney / 30;
            }
            await _houseInformationRepository.UpdateAsync(houseInf);

            var owenerInf = ObjectMapper.Map <OwnerInf, OwnerInfor>(input.OwnerInfs, mOwner);
            await _ownerInforRepository.UpdateAsync(owenerInf);

            await _homeListRepository.UpdateAsync(houseDetail);
        }
Exemplo n.º 2
0
        /// <summary>
        ///新建房源
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task AddHomeDetail(HouseInput input)
        {
            var houseDetail = ObjectMapper.Map <HouseInput, HomeList>(input);

            houseDetail.Id = GuidGenerator.Create();
            //houseDetail.Housecode = query.Housecode - 0 + 1;

            var houseInf = ObjectMapper.Map <HomeInf, HouseInformation>(input.homeInfs);

            houseInf.Id         = GuidGenerator.Create();
            houseInf.HomeListId = houseDetail.Id;
            if (houseInf.Price != 0)
            {
                houseInf.CenterPrice = houseInf.Price / houseDetail.BuildArea;
            }
            if (houseInf.RecentMoney != 0)
            {
                houseInf.MonthRecentMoney = houseInf.RecentMoney / 30;
            }
            await _houseInformationRepository.InsertAsync(houseInf);

            var owenerInf = ObjectMapper.Map <OwnerInf, OwnerInfor>(input.OwnerInfs);

            owenerInf.Id         = GuidGenerator.Create();
            owenerInf.HomeListId = houseDetail.Id;
            await _ownerInforRepository.InsertAsync(owenerInf);

            await _homeListRepository.InsertAsync(houseDetail);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 新增房屋
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task AddHouse(HouseInput input)
        {
            var houseDetail = ObjectMapper.Map <HouseInput, HouseInfer>(input);

            houseDetail.Id = GuidGenerator.Create();
            await _houseRepository.InsertAsync(houseDetail);
        }
Exemplo n.º 4
0
        public void TestHouseInput()
        {
            const string HouseString  = "{\"house_url\":\"http://127.0.0.1:8081\"}";
            const string DeviceString = "{\"ID\": 0, \"Class\": \"LightSwitch\"}";
            var          inp          = new HouseInput(HouseString, DeviceString);
            var          ls           = new LightSwitch(inp, null, _frame);

            Assert.IsTrue(ls.update());
            Assert.AreEqual(ls.Enabled, false);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Delete(HouseInput model)
        {
            int result = 0;

            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(HouseInput model)
        {
            int result = 0;

            return(result);
        }
Exemplo n.º 7
0
 public void NullTestHouseInput()
 {
     var testHI = new HouseInput(null, null);
 }