소스 검색

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,9 +56,7 @@ namespace UnivateProperties_API.Model.Properties
56 56
         [ForeignKey("Agency")]
57 57
         public int? AgencyId { get; set; }
58 58
         public DateTime DateAvailable { get; set; }
59
-        public DateTime StatusDate { get; set; }
60
-
61
-        [NotMapped]
59
+        public DateTime StatusDate { get; set; }        
62 60
         public virtual PropertyType PropertyType { get; set; }    
63 61
         [NotMapped]
64 62
         public Province Province { get; set; }

+ 2
- 2
UnivateProperties_API/Program.cs 파일 보기

@@ -18,8 +18,8 @@ namespace UnivateProperties_API
18 18
         public static IWebHost BuildWebHost(string[] args) =>
19 19
             WebHost.CreateDefaultBuilder(args)
20 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 23
                 .UseIISIntegration()
24 24
                 .Build();
25 25
     }

+ 16
- 2
UnivateProperties_API/Repository/Misc/CarouselRepository.cs 파일 보기

@@ -159,7 +159,15 @@ namespace UnivateProperties_API.Repository.Misc
159 159
                 };
160 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 171
                     carItem.Address = string.Format("{0}, {1} <br/>{2}", property.Suburb.Description, property.City.Description, property.AddressLine3);
164 172
                     carItem.IsProperty = true;
165 173
                 }
@@ -194,7 +202,13 @@ namespace UnivateProperties_API.Repository.Misc
194 202
 
195 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 212
                     item.Address = string.Format("{0}, {1} <br/>{2}", property.Suburb.Description, property.City.Description, property.AddressLine3);
199 213
                     item.IsProperty = true;
200 214
                 }

+ 12
- 6
UnivateProperties_API/Startup.cs 파일 보기

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

+ 1
- 0
UnivateProperties_API/UnivateProperties_API.csproj 파일 보기

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

+ 2
- 2
UnivateProperties_API/appsettings.json 파일 보기

@@ -8,8 +8,8 @@
8 8
     }
9 9
   },
10 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 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
 }

Loading…
취소
저장