Browse Source

Error handling to fix error in live

master
GJWilliams87 4 years ago
parent
commit
a5b8e31663

+ 1
- 1
UnivateProperties_API/Controllers/Users/RegisterController.cs View File

112
             }
112
             }
113
             catch(Exception ex)
113
             catch(Exception ex)
114
             {
114
             {
115
-                return new BadRequestResult();
115
+                return BadRequest(new { message = ex.Message + " - " + ex.InnerException + " - " + ex.StackTrace });
116
             }
116
             }
117
         }
117
         }
118
 
118
 

+ 7
- 3
UnivateProperties_API/Repository/Users/RegisterRepository.cs View File

1
 using Microsoft.AspNetCore.Authorization;
1
 using Microsoft.AspNetCore.Authorization;
2
 using Microsoft.AspNetCore.Mvc;
2
 using Microsoft.AspNetCore.Mvc;
3
+using Microsoft.EntityFrameworkCore;
3
 using System;
4
 using System;
4
 using System.Collections.Generic;
5
 using System.Collections.Generic;
5
 using System.Drawing.Text;
6
 using System.Drawing.Text;
195
                 user.PasswordSalt = passwordSalt;
196
                 user.PasswordSalt = passwordSalt;
196
             }
197
             }
197
 
198
 
198
-            _dbContext.Users.Update(user);
199
+            //_dbContext.Users.Update(user);
200
+            _dbContext.Entry(user).State = EntityState.Modified;
199
             _dbContext.SaveChanges();
201
             _dbContext.SaveChanges();
200
         }
202
         }
201
 
203
 
273
             user.PasswordSalt = passwordSalt;
275
             user.PasswordSalt = passwordSalt;
274
             user.FPToken = "";
276
             user.FPToken = "";
275
 
277
 
276
-            _dbContext.Users.Update(user);
278
+            //_dbContext.Users.Update(user);
279
+            _dbContext.Entry(user).State = EntityState.Modified;
277
             Save();
280
             Save();
278
         }
281
         }
279
 
282
 
401
                 //send ecrypted token to db
404
                 //send ecrypted token to db
402
                 user.FPToken = encryptedToken;
405
                 user.FPToken = encryptedToken;
403
 
406
 
404
-                _dbContext.Users.Update(user);
407
+                _dbContext.Entry(user).State = EntityState.Modified;
408
+                //_dbContext.Users.Update(user);
405
                 _dbContext.SaveChanges();
409
                 _dbContext.SaveChanges();
406
 
410
 
407
                 string linkStr = encryptedToken.Replace('/', '!');
411
                 string linkStr = encryptedToken.Replace('/', '!');

Loading…
Cancel
Save