read catalog API from web config
Instead of hard coding.
This commit is contained in:
		
							parent
							
								
									7daf4c0455
								
							
						
					
					
						commit
						7c559dd298
					
				@ -23,8 +23,8 @@ namespace eShopOnContainers.Core.Services.Catalog
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                // TODO:
 | 
			
		||||
                UriBuilder builder = new UriBuilder("http://catalog.api:5101");
 | 
			
		||||
                var baseURl = System.Configuration.ConfigurationManager.AppSettings["CatalogURL"];
 | 
			
		||||
                UriBuilder builder = new UriBuilder(baseURl);
 | 
			
		||||
 | 
			
		||||
                builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId);
 | 
			
		||||
 | 
			
		||||
@ -48,8 +48,8 @@ namespace eShopOnContainers.Core.Services.Catalog
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                // TODO:
 | 
			
		||||
                UriBuilder builder = new UriBuilder("http://catalog.api:5101");
 | 
			
		||||
                var baseURl = System.Configuration.ConfigurationManager.AppSettings["CatalogURL"];
 | 
			
		||||
                UriBuilder builder = new UriBuilder(baseURl);
 | 
			
		||||
 | 
			
		||||
                builder.Path = "api/v1/catalog/items";
 | 
			
		||||
 | 
			
		||||
@ -82,8 +82,8 @@ namespace eShopOnContainers.Core.Services.Catalog
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                // TODO:
 | 
			
		||||
                UriBuilder builder = new UriBuilder("http://catalog.api:5101");
 | 
			
		||||
                var baseURl = System.Configuration.ConfigurationManager.AppSettings["CatalogURL"];
 | 
			
		||||
                UriBuilder builder = new UriBuilder(baseURl);
 | 
			
		||||
 | 
			
		||||
                builder.Path = "api/v1/catalog/catalogbrands";
 | 
			
		||||
 | 
			
		||||
@ -107,8 +107,8 @@ namespace eShopOnContainers.Core.Services.Catalog
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                // TODO:
 | 
			
		||||
                UriBuilder builder = new UriBuilder("http://catalog.api:5101");
 | 
			
		||||
                var baseURl = System.Configuration.ConfigurationManager.AppSettings["CatalogURL"];
 | 
			
		||||
                UriBuilder builder = new UriBuilder(baseURl);
 | 
			
		||||
 | 
			
		||||
                builder.Path = "api/v1/catalog/catalogtypes";
 | 
			
		||||
 | 
			
		||||
@ -130,8 +130,8 @@ namespace eShopOnContainers.Core.Services.Catalog
 | 
			
		||||
 | 
			
		||||
        public Task DeleteCatalogItemAsync(string catalogItemId)
 | 
			
		||||
        {
 | 
			
		||||
            // TODO:
 | 
			
		||||
            UriBuilder builder = new UriBuilder("http://catalog.api:5101");
 | 
			
		||||
            var baseURl = System.Configuration.ConfigurationManager.AppSettings["CatalogURL"];
 | 
			
		||||
            UriBuilder builder = new UriBuilder(baseURl);
 | 
			
		||||
 | 
			
		||||
            builder.Path = $"api/v1/catalog/{catalogItemId}";
 | 
			
		||||
 | 
			
		||||
@ -142,8 +142,8 @@ namespace eShopOnContainers.Core.Services.Catalog
 | 
			
		||||
 | 
			
		||||
        public Task<CatalogItem> UpdateCatalogItemAsync(CatalogItem item)
 | 
			
		||||
        {
 | 
			
		||||
            // TODO:
 | 
			
		||||
            UriBuilder builder = new UriBuilder("http://catalog.api:5101");
 | 
			
		||||
            var baseURl = System.Configuration.ConfigurationManager.AppSettings["CatalogURL"];
 | 
			
		||||
            UriBuilder builder = new UriBuilder(baseURl);
 | 
			
		||||
 | 
			
		||||
            builder.Path = "api/v1/catalog/edit";
 | 
			
		||||
 | 
			
		||||
@ -154,8 +154,8 @@ namespace eShopOnContainers.Core.Services.Catalog
 | 
			
		||||
 | 
			
		||||
        public Task<CatalogItem> CreateCatalogItemAsync(CatalogItem item)
 | 
			
		||||
        {
 | 
			
		||||
            // TODO:
 | 
			
		||||
            UriBuilder builder = new UriBuilder("http://catalog.api:5101");
 | 
			
		||||
            var baseURl = System.Configuration.ConfigurationManager.AppSettings["CatalogURL"];
 | 
			
		||||
            UriBuilder builder = new UriBuilder(baseURl);
 | 
			
		||||
 | 
			
		||||
            builder.Path = "api/v1/catalog/create";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@
 | 
			
		||||
  </configSections>
 | 
			
		||||
  <appSettings>
 | 
			
		||||
    <add key="usefake" value="false" />
 | 
			
		||||
    <add key ="CatalogURL" value="http://catalog.api:5101" />
 | 
			
		||||
  </appSettings>
 | 
			
		||||
  <connectionStrings>
 | 
			
		||||
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-Catalog.WebForms-20170322110716.mdf;Initial Catalog=aspnet-Catalog.WebForms-20170322110716;Integrated Security=True" providerName="System.Data.SqlClient" />
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user