Explorar el Código

As Published - fixes WIP

master
George Williams hace 5 años
padre
commit
90264355eb

+ 1
- 1
UnivateProperties_API/Context/DataContext.cs Ver fichero

@@ -201,7 +201,7 @@ namespace UnivateProperties_API.Context
201 201
 
202 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 207
             connection.Close();

+ 3
- 1
UnivateProperties_API/Controllers/ProcessFlow/BidController.cs Ver fichero

@@ -53,7 +53,9 @@ namespace UnivateProperties_API.Controllers.ProcessFlow
53 53
             {
54 54
                 _Repo.InsertNew(item);
55 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 Ver fichero

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

+ 4
- 4
UnivateProperties_API/Repository/ProccessFlow/BidRepository.cs Ver fichero

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

+ 1
- 1
UnivateProperties_API/Repository/Properties/PropertyImageRepository.cs Ver fichero

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

+ 2
- 2
UnivateProperties_API/Repository/Properties/PropertyRepository.cs Ver fichero

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

+ 1
- 1
UnivateProperties_API/Startup.cs Ver fichero

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

Loading…
Cancelar
Guardar