public static Room ConvertToEFModel(RoomModel room) { Room model = new Room(); if (room != null) { model.RoomImageInfo = room.RoomImageInfo.Select(b => new RoomImageInfo { ImgUrl = b.ImgUrl, }).ToList(); model.RoomArea = room.RoomArea; model.Smoke = room.Smoke; model.AirportTransfer = room.AirportTransfer; model.Bathtub = room.Bathtub; model.BedType1 = room.BedType1; model.BedType2 = room.BedType2; model.BedType3 = room.BedType3; model.BedType4 = room.BedType4; model.Child = room.Child; model.Computer = room.Computer; model.Elevator = room.Elevator; model.Fridge = room.Fridge; model.Guide = room.Guide; model.HotWater = room.HotWater; model.Intercom = room.Intercom; model.IsBasement = room.IsBasement; model.LeftLuggage = room.LeftLuggage; model.Older = room.Older; model.Police = room.Police; model.PrivateBathroom = room.PrivateBathroom; model.PublicBathroom = room.PublicBathroom; model.RoomBalcony = room.RoomBalcony; model.RoomCity = room.RoomCity; model.RoomCount = room.RoomCount; model.RoomDetailedAddress = room.RoomDetailedAddress; model.RoomKitchen = room.RoomKitchen; model.RoomLang = room.RoomLang; model.RoomLong = room.RoomLong; model.Shower = room.Shower; model.RoomNumber = room.RoomNumber; model.RoomShi = room.RoomShi; model.RoomSpace = room.RoomSpace; model.RoomTing = room.RoomTing; model.RoomType = room.RoomType; model.Slippers = room.Slippers; model.Toiletries = room.Toiletries; model.Towel = room.Towel; model.WashingMechine = room.WashingMechine; model.Water = room.Water; model.RoomName = room.RoomName; model.RoomNameEN = room.RoomNameEN; model.RoomNameTW = room.RoomNameTW; } return model; }
public static RoomModel ConvertToViewModel(Room room) { string hostName = ConfigurationSettings.AppSettings["HOSTNAME"].ToString(); RoomModel model = new RoomModel(); if (room != null) { model.RoomImageInfo = room.RoomImageInfo.Select(b => new RoomImageInfoModel { ImgUrl = hostName + "Upload/RoomImg/" + b.ImgUrl, ImgUrlThumb = hostName + "Upload/RoomImg/Thumb/" + b.ImgUrl, OriginImg = b.ImgUrl }).ToList(); model.RoomArea = room.RoomArea; model.RoomTypeName = GetRoomType(room.RoomType); model.RoomBaseName = GetRoomBaseType(room.IsBasement); model.Smoke = room.Smoke.GetValueOrDefault(); model.AirportTransfer = room.AirportTransfer; model.Bathtub = room.Bathtub; model.BedType1 = room.BedType1; model.BedType2 = room.BedType2; model.BedType3 = room.BedType3; model.BedType4 = room.BedType4; model.Child = room.Child; model.Computer = room.Computer; model.Elevator = room.Elevator; model.Fridge = room.Fridge; model.Guide = room.Guide; model.HotWater = room.HotWater; model.Intercom = room.Intercom; model.IsBasement = room.IsBasement; model.LeftLuggage = room.LeftLuggage; model.Older = room.Older; model.Police = room.Police; model.PrivateBathroom = room.PrivateBathroom; model.PublicBathroom = room.PublicBathroom; model.RoomBalcony = room.RoomBalcony; model.RoomCity = room.RoomCity; model.RoomCount = room.RoomCount; model.RoomDetailedAddress = room.RoomDetailedAddress; model.RoomKitchen = room.RoomKitchen; model.RoomLang = room.RoomLang; model.RoomLong = room.RoomLong; model.Shower = room.Shower; model.RoomNumber = room.RoomNumber; model.RoomShi = room.RoomShi; model.RoomSpace = room.RoomSpace; model.RoomTing = room.RoomTing; model.RoomType = room.RoomType; model.Slippers = room.Slippers; model.Toiletries = room.Toiletries; model.Towel = room.Towel; model.WashingMechine = room.WashingMechine; model.Water = room.Water; model.RoomName = room.RoomName; model.RoomNameEN = room.RoomNameEN; model.RoomNameTW = room.RoomNameTW; } return model; }