Ejemplo n.º 1
0
        public object GetService(Type serviceType)
        {
            if (serviceType == typeof(UsersController))
            {
                var controller = new UsersController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }

            else if (serviceType == typeof(TurnoverTypesController))
            {
                var controller = new TurnoverTypesController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(SourceTypesController))
            {
                var controller = new SourceTypesController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(RecesiveTypesController))
            {
                var controller = new RecesiveTypesController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(NdsValuesController))
            {
                var controller = new NdsValuesController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(NaklStatusesController))
            {
                var controller = new NaklStatusesController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(ContractTypesController))
            {
                var controller = new ContractTypesController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(CompaniesController))
            {
                var controller = new CompaniesController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(NaklsController))
            {
                var controller = new NaklsController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(NaklFullsController))
            {
                var controller = new NaklFullsController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(NaklItemsController))
            {
                var controller = new NaklItemsController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(SgtinsController))
            {
                var controller = new SgtinsController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else if (serviceType == typeof(AcceptTypesController))
            {
                var controller = new AcceptTypesController(connectionString);
                AddInstance(serviceType, controller);
                return(controller);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
 public object GetService(Type serviceType)
 {
     if (serviceType == typeof(UsersController))
     {
         var dataBase   = new UserDataBase(connectionString);
         var controller = new UsersController(dataBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else if (serviceType == typeof(NaklStatusesController))
     {
         var dataBase   = new NaklStatusDataBase(connectionString);
         var controller = new NaklStatusesController(dataBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else if (serviceType == typeof(SgtinsController))
     {
         var sgtinDataBase    = new SgtinDataBase(connectionString);
         var naklDataBase     = new NaklDataBase(connectionString);
         var naklItemDateBase = new NaklItemDataBase(connectionString);
         var controller       = new SgtinsController(sgtinDataBase, naklDataBase, naklItemDateBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else if (serviceType == typeof(AddressesController))
     {
         var dataBase   = new AddressDataBase(connectionString);
         var controller = new AddressesController(dataBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else if (serviceType == typeof(NaklsController))
     {
         var naklDataBase     = new NaklDataBase(connectionString);
         var naklItemDataBase = new NaklItemDataBase(connectionString);
         var controller       = new NaklsController(naklDataBase, naklItemDataBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else if (serviceType == typeof(NaklItemsController))
     {
         var dataBase  = new NaklItemDataBase(connectionString);
         var controler = new NaklItemsController(dataBase);
         AddInstance(serviceType, controler);
         return(controler);
     }
     else if (serviceType == typeof(CompaniesController))
     {
         var dataBase   = new CompanyDataBase(connectionString);
         var controller = new CompaniesController(dataBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else if (serviceType == typeof(ReceiveTypesController))
     {
         var dataBase   = new RecesiverTypeDataBase(connectionString);
         var controller = new ReceiveTypesController(dataBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else if (serviceType == typeof(ContractTypesController))
     {
         var dataBase   = new ContractTypeDataBase(connectionString);
         var controller = new ContractTypesController(dataBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else if (serviceType == typeof(SourceTypesController))
     {
         var dataBase   = new SourceTypDataBase(connectionString);
         var controller = new SourceTypesController(dataBase);
         AddInstance(serviceType, controller);
         return(controller);
     }
     else
     {
         return(null);
     }
 }