예제 #1
0
        public static void DefineMappings()
        {
            AwMapper.CreateMap <PointOfSaleDevice, Pos>();

            AwMapper.CreateMap <PosDeviceResponse, PosResponse>()
            .ForMember(src => src.PosList, dst => dst.MapFrom(src => src.PosDeviceList));
        }
예제 #2
0
        public void Configuration(IAppBuilder app)
        {
            var configuration = new HttpConfiguration();

            // enable logging
            configuration.Filters.Add(new DiagnosticsFilterAttribute());

            // Web API configuration and services
            // CORS Attribute
            configuration.EnableCors(CorsManager.CorsAttribute());

            // Ensure HTTPS over TLS 1.2 for External and Prod
            SecurityProtocolManager.SetSecurityProtocol();

            // Set application specific Json Serialization settings
            SerializerManager.ApplyCustomSettings(configuration.Formatters);

            // Web API routes and application routes
            RoutesManager.AddRoutes(configuration);

            // Owin level exception handling
            app.Use <GlobalExceptionMiddleware>();

            // IoC and DI configuration
            configuration.DependencyResolver = ConfigureIocResolver();

            // Middleware for properties stored on the LogicalThreadContext for log4net and other purposes
            app.Use <RequestMetadataMiddleware>();

            var authMiddleware = (AuthMiddleware)configuration.DependencyResolver.GetService(typeof(IAuthMiddleware));

            app.Use(async(context, next) =>
            {
                await authMiddleware.Invoke(context, next);
            });

            // Global exception handler for AC errors
            configuration.Filters.Add(new MgiExceptionFilter());
            // Filter to add custom headers to the response
            configuration.Filters.Add(new HeaderFilter());
            AwMapper.Configure();

            // Web API documentation configuration
            // Web API documentation for environments that have ApiDocumentation app key set to true
            var keyName         = "ApiDocumentation";
            var apiDocKeyExists = ConfigurationManager.AppSettings.AllKeys.Contains(keyName);

            if (apiDocKeyExists && bool.Parse(ConfigurationManager.AppSettings[keyName]))
            {
                ApiDocumentationManager.Configure(configuration);
            }

            app.UseWebApi(configuration);
        }
 public static void DefineMappings()
 {
     AwMapper.CreateMap <Agent, AgentVm>();
 }
 public static void DefineMappings()
 {
     AwMapper.CreateMap <POELocationsForMoResponse, AgentsRespVm>()
     .ForMember(src => src.Agents, dst => dst.MapFrom(src => src.AgentList));
 }
 public static AgentsRespVm ToVm(this POELocationsForMoResponse locationsForMoResponse)
 {
     return(AwMapper.Map <POELocationsForMoResponse, AgentsRespVm>(locationsForMoResponse));
 }
 public static AgentsRespVm ToVm(this POEAgentLocationMoResponse poeAgentLocationMoResponse)
 {
     return(AwMapper.Map <POEAgentLocationMoResponse, AgentsRespVm>(poeAgentLocationMoResponse));
 }
 public static AgentsRespVm ToVm(this AgentLocationMoResponse agentLocationMoResponse)
 {
     return(AwMapper.Map <AgentLocationMoResponse, AgentsRespVm>(agentLocationMoResponse));
 }
예제 #8
0
 public static PosResponse ToVm(this PosDeviceResponse locationsForMoResponse)
 {
     return(AwMapper.Map <PosDeviceResponse, PosResponse>(locationsForMoResponse));
 }
        public static DwRegisterDeviceRequest ToModel(this DwRegisterDeviceReqVm dwRegisterDeviceReqVm)
        {
            var dwRegisterDeviceRequest = AwMapper.Map <DwRegisterDeviceReqVm, DwRegisterDeviceRequest>(dwRegisterDeviceReqVm);

            return(dwRegisterDeviceRequest);
        }
 public static void DefineMappings()
 {
     AwMapper.CreateMap <DwRegisterDeviceReqVm, DwRegisterDeviceRequest>();
 }