ソースを参照

Sorting issues form last publish & bug created when property model was changed

master
George Williams 4年前
コミット
b61cd3e755

+ 1
- 3
UnivateProperties_API/Model/Properties/Property.cs ファイルの表示

56
         [ForeignKey("Agency")]
56
         [ForeignKey("Agency")]
57
         public int? AgencyId { get; set; }
57
         public int? AgencyId { get; set; }
58
         public DateTime DateAvailable { get; set; }
58
         public DateTime DateAvailable { get; set; }
59
-        public DateTime StatusDate { get; set; }
60
-
61
-        [NotMapped]
59
+        public DateTime StatusDate { get; set; }        
62
         public virtual PropertyType PropertyType { get; set; }    
60
         public virtual PropertyType PropertyType { get; set; }    
63
         [NotMapped]
61
         [NotMapped]
64
         public Province Province { get; set; }
62
         public Province Province { get; set; }

+ 2
- 2
UnivateProperties_API/Program.cs ファイルの表示

18
         public static IWebHost BuildWebHost(string[] args) =>
18
         public static IWebHost BuildWebHost(string[] args) =>
19
             WebHost.CreateDefaultBuilder(args)
19
             WebHost.CreateDefaultBuilder(args)
20
                 .UseStartup<Startup>()
20
                 .UseStartup<Startup>()
21
-                //.UseUrls("http://192.168.6.188:5000")
22
-                .UseUrls("http://training.provision-sa.com:113")
21
+                //.UseUrls("http://localhost:57260")
22
+                .UseUrls("http://training.provision-sa.com:82")
23
                 .UseIISIntegration()
23
                 .UseIISIntegration()
24
                 .Build();
24
                 .Build();
25
     }
25
     }

+ 16
- 2
UnivateProperties_API/Repository/Misc/CarouselRepository.cs ファイルの表示

159
                 };
159
                 };
160
                 if (item.PropertyId > 0)
160
                 if (item.PropertyId > 0)
161
                 {
161
                 {
162
-                    var property = dBContext.Properties.Include("Province").Include("City").Include("Suburb").Where(p => p.Id == item.PropertyId).FirstOrDefault();
162
+                    var property = dBContext.Properties.Where(p => p.Id == item.PropertyId).FirstOrDefault();
163
+
164
+                    if (property != null)
165
+                    {                        
166
+                        property.Province = dBContext.Provinces.Where(p => p.Id == property.ProvinceId).FirstOrDefault();
167
+                        property.City = dBContext.Cities.Where(c => c.Id == property.CityId).FirstOrDefault();
168
+                        property.Suburb = dBContext.Suburbs.Where(s => s.Id == property.SuburbId).FirstOrDefault();
169
+                    }
170
+
163
                     carItem.Address = string.Format("{0}, {1} <br/>{2}", property.Suburb.Description, property.City.Description, property.AddressLine3);
171
                     carItem.Address = string.Format("{0}, {1} <br/>{2}", property.Suburb.Description, property.City.Description, property.AddressLine3);
164
                     carItem.IsProperty = true;
172
                     carItem.IsProperty = true;
165
                 }
173
                 }
194
 
202
 
195
                 if (item.PropertyId > 0)
203
                 if (item.PropertyId > 0)
196
                 {
204
                 {
197
-                    var property = dBContext.Properties.Include("Province").Include("City").Include("Suburb").Where(p => p.Id == item.PropertyId).FirstOrDefault();
205
+                    var property = dBContext.Properties.Where(p => p.Id == item.PropertyId).FirstOrDefault();
206
+                    if (property != null)
207
+                    {
208
+                        property.Province = dBContext.Provinces.Where(p => p.Id == property.ProvinceId).FirstOrDefault();
209
+                        property.City = dBContext.Cities.Where(c => c.Id == property.CityId).FirstOrDefault();
210
+                        property.Suburb = dBContext.Suburbs.Where(s => s.Id == property.SuburbId).FirstOrDefault();
211
+                    }
198
                     item.Address = string.Format("{0}, {1} <br/>{2}", property.Suburb.Description, property.City.Description, property.AddressLine3);
212
                     item.Address = string.Format("{0}, {1} <br/>{2}", property.Suburb.Description, property.City.Description, property.AddressLine3);
199
                     item.IsProperty = true;
213
                     item.IsProperty = true;
200
                 }
214
                 }

+ 12
- 6
UnivateProperties_API/Startup.cs ファイルの表示

1
 using AutoMapper;
1
 using AutoMapper;
2
 using Microsoft.AspNetCore.Authentication.JwtBearer;
2
 using Microsoft.AspNetCore.Authentication.JwtBearer;
3
 using Microsoft.AspNetCore.Builder;
3
 using Microsoft.AspNetCore.Builder;
4
+using Microsoft.AspNetCore.Cors.Infrastructure;
4
 using Microsoft.AspNetCore.Hosting;
5
 using Microsoft.AspNetCore.Hosting;
5
 using Microsoft.AspNetCore.Mvc;
6
 using Microsoft.AspNetCore.Mvc;
6
 using Microsoft.AspNetCore.Mvc.Cors.Internal;
7
 using Microsoft.AspNetCore.Mvc.Cors.Internal;
38
 namespace UnivateProperties_API
39
 namespace UnivateProperties_API
39
 {
40
 {
40
     public class Startup
41
     public class Startup
41
-    {
42
+    {       
42
         public Startup(IConfiguration configuration)
43
         public Startup(IConfiguration configuration)
43
         {            
44
         {            
44
             Configuration = configuration;
45
             Configuration = configuration;
47
         public IConfiguration Configuration { get; }
48
         public IConfiguration Configuration { get; }
48
 
49
 
49
         public void ConfigureServices(IServiceCollection services)
50
         public void ConfigureServices(IServiceCollection services)
50
-        {
51
+        {            
51
             services.AddAutoMapper();
52
             services.AddAutoMapper();
52
             services.AddCors(o => o.AddPolicy("MyPolicy", builder =>
53
             services.AddCors(o => o.AddPolicy("MyPolicy", builder =>
53
             {
54
             {
54
                 builder.AllowAnyOrigin()
55
                 builder.AllowAnyOrigin()
55
                        .AllowAnyMethod()
56
                        .AllowAnyMethod()
56
-                       .AllowAnyHeader();
57
+                       .AllowAnyHeader();                       
57
             }));            
58
             }));            
58
             services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
59
             services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
59
             services.AddDbContext<DataContext>(o => o.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
60
             services.AddDbContext<DataContext>(o => o.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
98
                 };
99
                 };
99
             });
100
             });
100
 
101
 
102
+            services.Configure<IISServerOptions>(options =>
103
+            {
104
+                options.AutomaticAuthentication = true;
105
+            });
106
+
101
             #region ProcessFlow
107
             #region ProcessFlow
102
             services.AddTransient<IBidRepository, BidRepository>();
108
             services.AddTransient<IBidRepository, BidRepository>();
103
             #endregion
109
             #endregion
156
             #endregion
162
             #endregion
157
             services.Configure<MvcOptions>(options =>
163
             services.Configure<MvcOptions>(options =>
158
             {
164
             {
159
-                options.Filters.Add(new CorsAuthorizationFilterFactory("MyPolicy"));
165
+                options.Filters.Add(new CorsAuthorizationFilterFactory("MyPolicy"));                
160
             });
166
             });
161
         }
167
         }
162
 
168
 
170
             app.UseCors(x => x
176
             app.UseCors(x => x
171
                 .AllowAnyOrigin()
177
                 .AllowAnyOrigin()
172
                 .AllowAnyMethod()
178
                 .AllowAnyMethod()
173
-                .AllowAnyHeader());
179
+                .AllowAnyHeader());                
174
             app.UseAuthentication();
180
             app.UseAuthentication();
175
             app.UseHttpsRedirection();
181
             app.UseHttpsRedirection();
176
             app.UseMvc();
182
             app.UseMvc();
187
                     //context.Database.Migrate();
193
                     //context.Database.Migrate();
188
                 }
194
                 }
189
             }
195
             }
190
-        }
196
+        }                
191
     }
197
     }
192
 }
198
 }

+ 1
- 0
UnivateProperties_API/UnivateProperties_API.csproj ファイルの表示

14
     <PackageReference Include="Abp.AutoMapper" Version="4.8.1" />
14
     <PackageReference Include="Abp.AutoMapper" Version="4.8.1" />
15
     <PackageReference Include="AutoMapper" Version="9.0.0" />
15
     <PackageReference Include="AutoMapper" Version="9.0.0" />
16
     <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
16
     <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
17
+    <PackageReference Include="Microsoft.AspNet.WebApi.Cors" Version="5.2.7" />
17
     <PackageReference Include="Microsoft.AspNetCore.App" />
18
     <PackageReference Include="Microsoft.AspNetCore.App" />
18
     <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
19
     <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
19
     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
20
     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />

+ 2
- 2
UnivateProperties_API/appsettings.json ファイルの表示

8
     }
8
     }
9
   },
9
   },
10
   "AllowedHosts": "*",
10
   "AllowedHosts": "*",
11
-  "ConnectionStrings": {    
12
-    "DefaultConnection": "Data Source=192.168.0.219;Initial Catalog=UniVateDemo;Persist Security Info=True;User Id=Provision;Password=What123!;Pooling=false;",
11
+  "ConnectionStrings": {
12
+    "DefaultConnection": "Data Source=localhost;Initial Catalog=UniVateDemo;Persist Security Info=True;User Id=Provision;Password=What123!;Pooling=false;",
13
     "TenderConnection": "http://www.unipoint-consoft.co.za/nph-srep.exe?cluvavail_test.sch&CLUB=LPA&RESORT=ALL&SUMMARY=N&HEAD=N"
13
     "TenderConnection": "http://www.unipoint-consoft.co.za/nph-srep.exe?cluvavail_test.sch&CLUB=LPA&RESORT=ALL&SUMMARY=N&HEAD=N"
14
   }
14
   }
15
 }
15
 }

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