public static int AddHouseRoom(HouseRoomEnt roomEnt) { var sql = @"insert into houseroom(HouseID,LivingroomCount,BedroomCount,KitchenCount,BathroomCount) values(@HouseID,@LivingroomCount,@BedroomCount,@KitchenCount,@BathroomCount);"; return(DBHelper.Conn.Execute(sql, roomEnt)); }
public ModelResult AddHouse(HouseRequest request) { var houseEnt = new HouseEnt { AreaId = request.AreaID, Community = request.Community, Type = request.Type, FloorType = request.FloorType, Direction = request.Direction, DecorateType = request.DecorateType, Area = request.Area, Age = request.Age, CreateUserType = request.CreateUserType, CreateUserID = request.CreateUserID, CreateTime = request.CreateTime, ContactMobile = request.ContactMobile, Memo = request.Memo }; houseEnt.ID = HouseRepository.AddHouse(houseEnt); var housePriceEnt = new HousePriceEnt { HouseID = houseEnt.ID, FirstPrice = request.FirstPrice, TotalPrice = request.TotalPrice }; HouseRepository.AddHousePrice(housePriceEnt); var houseRoom = new HouseRoomEnt { HouseID = houseEnt.ID, BathroomCount = request.BathroomCount, BedroomCount = request.BedroomCount, KitchenCount = request.KitchenCount, LivingroomCount = request.LivingroomCount }; HouseRepository.AddHouseRoom(houseRoom); var houseImages = request.HouseImages.Select(x => new HouseImageEnt { HouseID = houseEnt.ID, Image = x }).ToList(); HouseRepository.AddHouseImage(houseImages); return(new ModelResult { Data = HouseRepository.QueryHouseByID(houseEnt.ID) }); }