Пример #1
0
        public ActionResult Edit(HouseEditModel model)
        {
            HouseDTO dto = new HouseDTO();

            dto.Address         = model.address;
            dto.Area            = model.area;
            dto.AttachmentIds   = model.attachmentIds;
            dto.CheckInDateTime = model.checkInDateTime;
            //有没有感觉强硬用一些不适合的DTO,有一些没用的属性时候的迷茫?
            dto.CommunityId      = model.CommunityId;
            dto.DecorateStatusId = model.DecorateStatusId;
            dto.Description      = model.description;
            dto.Direction        = model.direction;
            dto.FloorIndex       = model.floorIndex;
            dto.Id = model.Id;
            dto.LookableDateTime = model.lookableDateTime;
            dto.MonthRent        = model.monthRent;
            dto.OwnerName        = model.ownerName;
            dto.OwnerPhoneNum    = model.ownerPhoneNum;
            dto.RoomTypeId       = model.RoomTypeId;
            dto.StatusId         = model.StatusId;
            dto.TotalFloorCount  = model.totalFloor;
            dto.TypeId           = model.TypeId;
            houseService.Update(dto);

            CreateStaticPage(model.Id);//编辑房源的时候重新生成静态页面
            return(Json(new AjaxResult {
                Status = "ok"
            }));
        }
Пример #2
0
        public ActionResult Edit(HouseEditModel houseEdit)
        {
            HouseDTO house = new HouseDTO();

            house.Id               = houseEdit.Id;
            house.Address          = houseEdit.Address;
            house.Area             = houseEdit.Area;
            house.MonthRent        = houseEdit.MonthRent;
            house.CheckInDateTime  = houseEdit.CheckInDateTime;
            house.CommunityId      = houseEdit.CommunityId;
            house.DecorateStatusId = houseEdit.DecorateStatusId;
            house.Description      = houseEdit.Description;
            house.Direction        = houseEdit.Direction;
            house.FloorIndex       = houseEdit.FloorIndex;
            house.LookableDateTime = houseEdit.LookableDateTime;
            house.OwnerName        = houseEdit.OwnerName;
            house.OwnerPhoneNum    = houseEdit.OwnerPhoneNum;
            house.RegionId         = houseEdit.RegionId;
            house.RoomTypeId       = houseEdit.RoomTypeId;
            house.StatusId         = houseEdit.StatusId;
            house.TotalFloatCount  = houseEdit.TotalFloatCount;
            house.TypeId           = houseEdit.TypeId;
            HouseService.UpdateHouse(house);
            CreateStaticPage(house.Id);
            return(Json(new AjaxResult {
                Status = "ok"
            }));
        }
Пример #3
0
 public ActionResult Edit(HouseEditModel model)
 {
     try
     {
         HouseDTO dto = new HouseDTO();
         dto.Address         = model.address;
         dto.Area            = model.area;
         dto.AttachmentIds   = model.attachmentIds;
         dto.CheckInDateTime = model.checkInDateTime;
         //有没有感觉强硬用一些不适合的DTO,有一些没用的属性时候的迷茫?
         dto.CommunityId      = model.CommunityId;
         dto.DecorateStatusId = model.DecorateStatusId;
         dto.Description      = model.description;
         dto.Direction        = model.direction;
         dto.FloorIndex       = model.floorIndex;
         dto.Id = model.Id;
         dto.LookableDateTime = model.lookableDateTime;
         dto.MonthRent        = model.monthRent;
         dto.OwnerName        = model.ownerName;
         dto.OwnerPhoneNum    = model.ownerPhoneNum;
         dto.RoomTypeId       = model.RoomTypeId;
         dto.StatusId         = model.StatusId;
         dto.TotalFloorCount  = model.totalFloor;
         dto.TypeId           = model.TypeId;
         HouseService.Update(dto);
         return(Json(new AjaxResult <object> {
             code = 0, msg = "编辑成功"
         }));
     }
     catch (Exception ex)
     {
         Log.ErrorFormat("编辑失败:{0}", ex.Message);
         return(Json(new AjaxResult <object>
         {
             code = 1,
             msg = ex.Message
         }));;
     }
 }
Пример #4
0
        [ValidateInput(false)]  //允许输入的内容包含标签 脚本 解决 从客户端中检测到有潜在危险的 Request.Form 值错误
        public ActionResult Edit(HouseEditModel model)
        {
            long userId = (long)AdminHelper.GetUserId(HttpContext);
            var  user   = AdminUserService.GetById(userId);

            if (user.CityId == null)
            {
                return(View("ERROR", (object)"总部不能进行房源管理"));
            }
            var house = HouseService.GetById(model.HouseId);

            house.Address          = model.Address;
            house.Area             = model.Area;
            house.AttachmentIds    = model.AttachmentIds;
            house.CheckInDateTime  = model.CheckInDateTime;
            house.CommunityId      = model.CommunityId;
            house.Description      = model.Description;
            house.DecorateStatusId = model.DecorateStatusId;
            house.Direction        = model.Direction;
            house.FloorIndex       = model.FloorIndex;
            house.LookableDateTime = model.LookableDateTime;
            house.MonthRent        = model.MonthRent;
            house.OwnerName        = model.OwnerName;
            house.OwnerPhoneNum    = model.OwnerPhoneNum;
            house.RoomTypeId       = model.RoomTypeId;
            house.StatusId         = model.StatusId;
            house.TypeId           = model.TypeId;
            house.TotalFloorCount  = model.TotalFloorCount;
            HouseService.Update(house);
            //编辑房源后,也生成静态页
            CreateStaticPages(model.HouseId);
            return(Json(new AjaxResult()
            {
                Status = "ok"
            }));
        }