Browse Source

As Published - fixes WIP

master
George Williams 5 years ago
parent
commit
90264355eb

+ 1
- 1
UnivateProperties_API/Context/DataContext.cs View File

201
 
201
 
202
             while(reader.Read())
202
             while(reader.Read())
203
             {
203
             {
204
-                returnValue = int.Parse(reader[0].ToString());
204
+                returnValue = int.Parse(reader[0] == null ? "0" : reader[0].ToString() == "" ? "0" : reader[0].ToString());
205
             }
205
             }
206
 
206
 
207
             connection.Close();
207
             connection.Close();

+ 3
- 1
UnivateProperties_API/Controllers/ProcessFlow/BidController.cs View File

53
             {
53
             {
54
                 _Repo.InsertNew(item);
54
                 _Repo.InsertNew(item);
55
                 scope.Complete();
55
                 scope.Complete();
56
-                return CreatedAtAction(nameof(Get), new { id = item.Id }, item);
56
+                //return CreatedAtAction(nameof(Get), new { id = item.Id }, item);
57
+                var bid = _Repo.Get(x => x.Id == item.Id);
58
+                return new OkObjectResult(bid);
57
             }
59
             }
58
         }
60
         }
59
 
61
 

+ 5
- 1
UnivateProperties_API/Repository/Misc/CarouselRepository.cs View File

64
             Save();
64
             Save();
65
 
65
 
66
             bool saveFiles = false;
66
             bool saveFiles = false;
67
-            var loc = dBContext.Location.FirstOrDefault().PropertyImageLocation;
67
+            var loc = dBContext.Location.FirstOrDefault()?.PropertyImageLocation;
68
             var lastID = item.Id;
68
             var lastID = item.Id;
69
             item.Id = lastID;
69
             item.Id = lastID;
70
             if (!string.IsNullOrEmpty(loc))
70
             if (!string.IsNullOrEmpty(loc))
81
                 string path = ImageFormatter.Base64ToImage(image, loc, lastID.ToString());
81
                 string path = ImageFormatter.Base64ToImage(image, loc, lastID.ToString());
82
                 item.Image = path;
82
                 item.Image = path;
83
             }
83
             }
84
+            else
85
+            {
86
+                item.Image = image;
87
+            }
84
 
88
 
85
             Update(item);
89
             Update(item);
86
             
90
             

+ 4
- 4
UnivateProperties_API/Repository/ProccessFlow/BidRepository.cs View File

189
             var week = _dbContext.Weeks.Include("Owner").Where(x => x.Id == item.TimeshareWeekId).FirstOrDefault();
189
             var week = _dbContext.Weeks.Include("Owner").Where(x => x.Id == item.TimeshareWeekId).FirstOrDefault();
190
             var property = _dbContext.Properties.Include("Owner").Where(x => x.Id == item.PropertyId).FirstOrDefault();
190
             var property = _dbContext.Properties.Include("Owner").Where(x => x.Id == item.PropertyId).FirstOrDefault();
191
             BidItem bid = new BidItem();
191
             BidItem bid = new BidItem();
192
+            bid.Id = _dbContext.GetMaxID("BidItems") + 1;
192
 
193
 
193
             foreach (string prop in bid.GetAllProperties())
194
             foreach (string prop in bid.GetAllProperties())
194
             {
195
             {
235
                             }
236
                             }
236
                         }
237
                         }
237
                     }
238
                     }
238
-                }
239
-                                    
239
+                }                
240
                 _dbContext.Add(bid);
240
                 _dbContext.Add(bid);
241
                 Save();
241
                 Save();
242
             }
242
             }
262
                             }
262
                             }
263
                         }
263
                         }
264
                     }
264
                     }
265
-                }
266
-                
265
+                }                
267
                 _dbContext.Add(bid);
266
                 _dbContext.Add(bid);
268
                 Save();
267
                 Save();
269
             }
268
             }
269
+            item.Id = bid.Id;
270
         }
270
         }
271
 
271
 
272
         public void Insert(IEnumerable<BidItem> items)
272
         public void Insert(IEnumerable<BidItem> items)

+ 1
- 1
UnivateProperties_API/Repository/Properties/PropertyImageRepository.cs View File

129
                 var lastID = dBContext.GetMaxID("PropertyImages");
129
                 var lastID = dBContext.GetMaxID("PropertyImages");
130
 
130
 
131
                 bool saveFiles = false;
131
                 bool saveFiles = false;
132
-                var loc = dBContext.Location.FirstOrDefault().PropertyImageLocation;
132
+                var loc = dBContext.Location.FirstOrDefault()?.PropertyImageLocation;
133
                 if (!string.IsNullOrEmpty(loc))
133
                 if (!string.IsNullOrEmpty(loc))
134
                 {
134
                 {
135
                     saveFiles = true;
135
                     saveFiles = true;

+ 2
- 2
UnivateProperties_API/Repository/Properties/PropertyRepository.cs View File

736
                 var lastID = dBContext.GetMaxID("PropertyImages");
736
                 var lastID = dBContext.GetMaxID("PropertyImages");
737
 
737
 
738
                 bool saveFiles = false;
738
                 bool saveFiles = false;
739
-                var loc = dBContext.Location.FirstOrDefault().PropertyImageLocation;
739
+                var loc = dBContext.Location.FirstOrDefault()?.PropertyImageLocation;
740
                 if (!string.IsNullOrEmpty(loc))
740
                 if (!string.IsNullOrEmpty(loc))
741
                 {
741
                 {
742
                     saveFiles = true;
742
                     saveFiles = true;
798
                 var lastID = dBContext.GetMaxID("PropertyImages");
798
                 var lastID = dBContext.GetMaxID("PropertyImages");
799
 
799
 
800
                 bool saveFiles = false;
800
                 bool saveFiles = false;
801
-                var loc = dBContext.Location.FirstOrDefault().PropertyImageLocation;
801
+                var loc = dBContext.Location.FirstOrDefault()?.PropertyImageLocation;
802
                 if (!string.IsNullOrEmpty(loc))
802
                 if (!string.IsNullOrEmpty(loc))
803
                 {
803
                 {
804
                     saveFiles = true;
804
                     saveFiles = true;

+ 1
- 1
UnivateProperties_API/Startup.cs View File

52
                 builder.AllowAnyOrigin()
52
                 builder.AllowAnyOrigin()
53
                        .AllowAnyMethod()
53
                        .AllowAnyMethod()
54
                        .AllowAnyHeader();
54
                        .AllowAnyHeader();
55
-            }));
55
+            }));            
56
             services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
56
             services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
57
             services.AddDbContext<DataContext>(o => o.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));
57
             services.AddDbContext<DataContext>(o => o.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));
58
             MyCommon.TenderUrl = Configuration.GetConnectionString("TenderConnection");
58
             MyCommon.TenderUrl = Configuration.GetConnectionString("TenderConnection");

Loading…
Cancel
Save