DocSpace-client/products/ASC.CRM/Server/Startup.cs

99 lines
3.2 KiB
C#
Raw Normal View History

using System.Text;
using ASC.Api.Core;
2020-04-14 18:59:32 +00:00
using ASC.Common;
2021-03-13 12:22:14 +00:00
using ASC.CRM.Api;
using ASC.Web.CRM.HttpHandlers;
2021-03-13 12:22:14 +00:00
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
2020-03-02 15:38:31 +00:00
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace ASC.CRM
{
public class Startup : BaseStartup
2020-03-02 15:38:31 +00:00
{
2020-04-16 19:41:37 +00:00
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment)
: base(configuration, hostEnvironment)
2020-03-02 15:38:31 +00:00
{
}
public override void ConfigureServices(IServiceCollection services)
2020-03-02 15:38:31 +00:00
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
2020-03-02 15:38:31 +00:00
2021-03-13 12:22:14 +00:00
services.AddMemoryCache();
base.ConfigureServices(services);
2021-03-10 15:38:56 +00:00
DIHelper.TryAdd<CasesController>();
DIHelper.TryAdd<ContactInfosController>();
DIHelper.TryAdd<ContactsController>();
DIHelper.TryAdd<CurrencyRatesController>();
DIHelper.TryAdd<CustomFieldsController>();
DIHelper.TryAdd<TasksController>();
DIHelper.TryAdd<DealsController>();
DIHelper.TryAdd<InvoicesController>();
DIHelper.TryAdd<ListItemsController>();
DIHelper.TryAdd<RelationshipEventsController>();
DIHelper.TryAdd<ReportsController>();
2021-03-10 15:38:56 +00:00
DIHelper.TryAdd<TagsController>();
DIHelper.TryAdd<TasksController>();
DIHelper.TryAdd<TaskTemplateController>();
DIHelper.TryAdd<UtilsController>();
DIHelper.TryAdd<VoIPController>();
2021-03-13 12:22:14 +00:00
}
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
base.Configure(app, env);
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("httphandlers/contactphotohandler.ashx"),
appBranch =>
{
appBranch.UseContactPhotoHandler();
});
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("httphandlers/filehandler.ashx"),
appBranch =>
{
appBranch.UseFileHandler();
});
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("httphandlers/fileuploaderhandler.ashx"),
appBranch =>
{
appBranch.UseFileUploaderHandler();
});
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("httphandlers/importfilehandler.ashx"),
appBranch =>
{
appBranch.UseImportFileHandlerHandler();
});
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("httphandlers/organisationlogohandler.ashx"),
appBranch =>
{
appBranch.UseOrganisationLogoHandler();
});
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("httphandlers/webtoleadfromhandler.ashx"),
appBranch =>
{
appBranch.UseWebToLeadFromHandlerHandler();
});
}
2020-03-02 15:38:31 +00:00
}
}