ソースを参照

Forgot Password Update

master
30117125 4年前
コミット
bf561046d1

+ 15
- 5
UnivateProperties_API/Controllers/Timeshare/TimeshareWeekController.cs ファイルの表示

@@ -1,5 +1,7 @@
1 1
 using Microsoft.AspNetCore.Mvc;
2
+using System;
2 3
 using System.Linq;
4
+using System.Net;
3 5
 using System.Transactions;
4 6
 using UnivateProperties_API.Containers.Timeshare;
5 7
 using UnivateProperties_API.Model.Timeshare;
@@ -93,13 +95,21 @@ namespace UnivateProperties_API.Controllers.Timeshare
93 95
         [HttpPost]
94 96
         public IActionResult Post([FromBody] TimeshareWeekDto item)
95 97
         {
96
-            using (var scope = new TransactionScope())
98
+            try
97 99
             {
98
-                var id = _Repo.SaveNewWeek(item);                
99
-                var savedItem = _Repo.Get(x => x.Id == id).FirstOrDefault();
100
-                scope.Complete();
101
-                return new OkObjectResult(savedItem);
100
+                using (var scope = new TransactionScope())
101
+                {
102
+                    var id = _Repo.SaveNewWeek(item);
103
+                    var savedItem = _Repo.Get(x => x.Id == id).FirstOrDefault();
104
+                    scope.Complete();
105
+                    return new OkObjectResult(savedItem);
106
+                }
107
+            }
108
+            catch(Exception ex)
109
+            {
110
+                return StatusCode((int)HttpStatusCode.InternalServerError, ex);
102 111
             }
112
+            
103 113
         }
104 114
 
105 115
         [HttpPut]

+ 11
- 3
UnivateProperties_API/Repository/Communication/SMTPAccountRepository.cs ファイルの表示

@@ -29,9 +29,17 @@ namespace UnivateProperties_API.Repository.Communication
29 29
         public SMTPAccount GetDetailed(Func<SMTPAccount, bool> first)
30 30
         {
31 31
             var item = _dbContext.Accounts.FirstOrDefault(first);
32
-            SMTPHostRepository host = new SMTPHostRepository(_dbContext);
33
-            item.SMTPHost = host.GetDetailed(x => x.Id == item.SMTPHostId);
34
-            return item;
32
+
33
+            if (item != null)
34
+            {
35
+                SMTPHostRepository host = new SMTPHostRepository(_dbContext);
36
+                item.SMTPHost = host.GetDetailed(x => x.Id == item.SMTPHostId);
37
+                return item;
38
+            }
39
+            else
40
+            {
41
+                throw(new Exception());
42
+            }
35 43
         }
36 44
 
37 45
         public List<SMTPAccount> GetDetailedAll()

+ 2
- 1
UnivateProperties_API/Repository/Communication/TemplateRepository.cs ファイルの表示

@@ -202,8 +202,9 @@ namespace UnivateProperties_API.Repository.Communication
202 202
                         EmailRepository emailRepo = new EmailRepository(_dbContext);
203 203
                         emailRepo.Insert(email);
204 204
                     }
205
-                    catch (Exception)
205
+                    catch (Exception ex)
206 206
                     {
207
+                        throw (ex);
207 208
                     }
208 209
                 }
209 210
             }

+ 23
- 15
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs ファイルの表示

@@ -821,27 +821,35 @@ namespace UnivateProperties_API.Repository.Timeshare
821 821
             
822 822
             var template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Owner");
823 823
 
824
-            if (agent != null)
824
+            try
825 825
             {
826
-                template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Agent");
827
-                if (template != null)
826
+                if (agent != null)
828 827
                 {
829
-                    templateRepository.SendEmailTemplateWeek(template, agent, sellItem);
830
-                }
831
-            }
832
-            else 
833
-            {
834
-                if (template != null)
835
-                {
836
-                    templateRepository.SendEmailTemplateWeek(template, owner, sellItem);
828
+                    template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Agent");
829
+                    if (template != null)
830
+                    {
831
+                        templateRepository.SendEmailTemplateWeek(template, agent, sellItem);
832
+                    }
837 833
                 }
838
-                template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-UV");
839
-                if (template != null)
834
+                else
840 835
                 {
841
-                    templateRepository.SendEmailTemplate(template, sellItem.Owner, new List<BaseEntity>() { sellItem, sellItem.Owner });
836
+                    if (template != null)
837
+                    {
838
+                        templateRepository.SendEmailTemplateWeek(template, owner, sellItem);
839
+                    }
840
+                    template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-UV");
841
+                    if (template != null)
842
+                    {
843
+                        templateRepository.SendEmailTemplate(template, sellItem.Owner, new List<BaseEntity>() { sellItem, sellItem.Owner });
844
+                    }
845
+
842 846
                 }
843
-                
844 847
             }
848
+            catch(Exception ex)
849
+            {
850
+                throw (ex);
851
+            }
852
+            
845 853
 
846 854
 
847 855
             week.StatusId = 32;

+ 2
- 1
UnivateProperties_API/Repository/Users/RegisterRepository.cs ファイルの表示

@@ -408,7 +408,8 @@ namespace UnivateProperties_API.Repository.Users
408 408
 
409 409
                 //change below to test locally or QA
410 410
                 //string url = "http://localhost:8080/#/forgotPasswordReset/" + linkStr;
411
-                string url = "http://training.provision-sa.com:122/#/forgotPasswordReset/" + linkStr;
411
+                //string url = "http://training.provision-sa.com:122/#/forgotPasswordReset/" + linkStr;
412
+                string url = "https://www.pvsl.co.za:97/#/forgotPasswordReset/" + linkStr;
412 413
 
413 414
                 mailer.ForgotPassword(new MailModel
414 415
                 {

読み込み中…
キャンセル
保存