|
@@ -1,10 +1,8 @@
|
1
|
1
|
using AutoMapper;
|
2
|
2
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
3
|
3
|
using Microsoft.AspNetCore.Builder;
|
4
|
|
-using Microsoft.AspNetCore.Cors.Infrastructure;
|
5
|
4
|
using Microsoft.AspNetCore.Hosting;
|
6
|
5
|
using Microsoft.AspNetCore.Mvc;
|
7
|
|
-using Microsoft.AspNetCore.Mvc.Cors.Internal;
|
8
|
6
|
using Microsoft.EntityFrameworkCore;
|
9
|
7
|
using Microsoft.Extensions.Configuration;
|
10
|
8
|
using Microsoft.Extensions.DependencyInjection;
|
|
@@ -14,11 +12,9 @@ using System.Threading.Tasks;
|
14
|
12
|
using UnivateProperties_API.Context;
|
15
|
13
|
using UnivateProperties_API.Helpers;
|
16
|
14
|
using UnivateProperties_API.Model.Banks;
|
17
|
|
-using UnivateProperties_API.Model.Campaigns;
|
18
|
15
|
using UnivateProperties_API.Model.Communication;
|
19
|
16
|
using UnivateProperties_API.Model.Financial;
|
20
|
17
|
using UnivateProperties_API.Model.Misc;
|
21
|
|
-using UnivateProperties_API.Model.ProcessFlow;
|
22
|
18
|
using UnivateProperties_API.Model.Properties;
|
23
|
19
|
using UnivateProperties_API.Model.Region;
|
24
|
20
|
using UnivateProperties_API.Model.Timeshare;
|
|
@@ -50,13 +46,14 @@ namespace UnivateProperties_API
|
50
|
46
|
public void ConfigureServices(IServiceCollection services)
|
51
|
47
|
{
|
52
|
48
|
services.AddAutoMapper();
|
|
49
|
+ services.AddHealthChecks();
|
|
50
|
+ services.AddControllers();
|
53
|
51
|
services.AddCors(o => o.AddPolicy("MyPolicy", builder =>
|
54
|
52
|
{
|
55
|
53
|
builder.AllowAnyOrigin()
|
56
|
54
|
.AllowAnyMethod()
|
57
|
55
|
.AllowAnyHeader();
|
58
|
|
- }));
|
59
|
|
- services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
|
|
56
|
+ }));
|
60
|
57
|
services.AddDbContext<DataContext>(o => o.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
|
61
|
58
|
MyCommon.TenderUrl = Configuration.GetConnectionString("TenderConnection");
|
62
|
59
|
MyCommon.Reservations = Configuration.GetConnectionString("ReservationsURL");
|
|
@@ -174,10 +171,6 @@ namespace UnivateProperties_API
|
174
|
171
|
#region Campaign
|
175
|
172
|
services.AddTransient<ICampaignRepository, CampaignRepository>();
|
176
|
173
|
#endregion
|
177
|
|
- services.Configure<MvcOptions>(options =>
|
178
|
|
- {
|
179
|
|
- options.Filters.Add(new CorsAuthorizationFilterFactory("MyPolicy"));
|
180
|
|
- });
|
181
|
174
|
}
|
182
|
175
|
|
183
|
176
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
|
@@ -187,13 +180,17 @@ namespace UnivateProperties_API
|
187
|
180
|
//{
|
188
|
181
|
app.UseDeveloperExceptionPage();
|
189
|
182
|
//}
|
|
183
|
+ app.UseRouting();
|
190
|
184
|
app.UseCors(x => x
|
191
|
185
|
.AllowAnyOrigin()
|
192
|
186
|
.AllowAnyMethod()
|
193
|
187
|
.AllowAnyHeader());
|
194
|
188
|
app.UseAuthentication();
|
195
|
189
|
app.UseHttpsRedirection();
|
196
|
|
- app.UseMvc();
|
|
190
|
+ app.UseEndpoints(endpoints =>
|
|
191
|
+ {
|
|
192
|
+ endpoints.MapControllers(); //Routes for my API controllers
|
|
193
|
+ });
|
197
|
194
|
}
|
198
|
195
|
|
199
|
196
|
private static void UpdateDatabase(IApplicationBuilder app)
|