|
@@ -77,7 +77,7 @@ namespace UnivateProperties_API.Repository.Misc
|
77
|
77
|
}
|
78
|
78
|
if (saveFiles)
|
79
|
79
|
{
|
80
|
|
- string path = ImageFormatter.Base64ToImage(item.Image, loc, lastID.ToString());
|
|
80
|
+ string path = ImageFormatter.Base64ToImage(image, loc, lastID.ToString());
|
81
|
81
|
item.Image = path;
|
82
|
82
|
}
|
83
|
83
|
|
|
@@ -142,12 +142,13 @@ namespace UnivateProperties_API.Repository.Misc
|
142
|
142
|
var CarouselList = dBContext.Carousel.ToList();
|
143
|
143
|
|
144
|
144
|
foreach (var item in CarouselList)
|
145
|
|
- {
|
|
145
|
+ {
|
146
|
146
|
if (!string.IsNullOrEmpty(item.Image) && !item.Image.StartsWith("data:image"))
|
147
|
147
|
item.Image = ImageFormatter.ImageToBase64(item.Image);
|
148
|
148
|
|
149
|
149
|
var carItem = new CarouselList()
|
150
|
150
|
{
|
|
151
|
+ Id = item.Id,
|
151
|
152
|
Image = item.Image,
|
152
|
153
|
Header = item.Header
|
153
|
154
|
};
|
|
@@ -172,5 +173,38 @@ namespace UnivateProperties_API.Repository.Misc
|
172
|
173
|
|
173
|
174
|
return list;
|
174
|
175
|
}
|
|
176
|
+
|
|
177
|
+ public CarouselList GetCarousel(int id)
|
|
178
|
+ {
|
|
179
|
+ var carousel = dBContext.Carousel.Where(c => c.Id == id).FirstOrDefault();
|
|
180
|
+
|
|
181
|
+ CarouselList item = new CarouselList();
|
|
182
|
+ if (carousel != null)
|
|
183
|
+ {
|
|
184
|
+ foreach (string prop in carousel.GetAllProperties())
|
|
185
|
+ {
|
|
186
|
+ if (prop != "Item" && prop != "Display")
|
|
187
|
+ item[prop] = carousel[prop];
|
|
188
|
+ }
|
|
189
|
+
|
|
190
|
+ if (item.PropertyId > 0)
|
|
191
|
+ {
|
|
192
|
+ var property = dBContext.Properties.Include("Province").Include("City").Include("Suburb").Where(p => p.Id == item.PropertyId).FirstOrDefault();
|
|
193
|
+ item.Address = string.Format("{0}, {1} <br/>{2}", property.Suburb.Description, property.City.Description, property.AddressLine3);
|
|
194
|
+ item.IsProperty = true;
|
|
195
|
+ }
|
|
196
|
+ if (item.TimeshareId > 0)
|
|
197
|
+ {
|
|
198
|
+ var timeshare = dBContext.Weeks.Where(t => t.Id == item.TimeshareId).FirstOrDefault();
|
|
199
|
+ item.Bedrooms = timeshare.Bedrooms;
|
|
200
|
+ item.Sleeps = timeshare.MaxSleep;
|
|
201
|
+ item.Arrival = timeshare.ArrivalDate;
|
|
202
|
+ item.Departure = timeshare.DepartureDate;
|
|
203
|
+ item.IsProperty = false;
|
|
204
|
+ }
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ return item;
|
|
208
|
+ }
|
175
|
209
|
}
|
176
|
210
|
}
|