Esempio n. 1
0
 public ProvidersController(ProvidersHandler providersHandler, IHttpContextAccessor httpContextAccessor, GetLang _getLang)
 {
     _providersHandler    = providersHandler;
     _httpContextAccessor = httpContextAccessor;
     getLang  = _getLang;
     langcode = getLang.GetLanguage();
 }
        public string getAllProductBranches(int parentID)
        {
            ReturnObject <List <GET_ALL_BRANCHESResult> > output = null;

            try
            {
                ProvidersHandler handler = new ProvidersHandler();

                List <GET_ALL_BRANCHESResult> branchesList = handler.getAllProductBranches(parentID);
                output = new ReturnObject <List <GET_ALL_BRANCHESResult> >(ErrorConstants.SUCCESS, branchesList);

                if (branchesList != null && branchesList.Count > 0)
                {
                    return(JsonConvert.SerializeObject(output));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new ReturnObject <string>(ErrorConstants.ERROR_FAILED_GET_PRODUCT_BRANCHES, ErrorConstants.ERROR_FAILED_GET_PRODUCT_BRANCHES_MSG)));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new ReturnObject <string>(ErrorConstants.ERROR_EXCEPTION, ex.Message)));
            }
        }
 public ProvidersController(IListFactory listFactory, ILogger <ProvidersController> logger, ProvidersHandler providersHandler, IHttpContextAccessor httpContextAccessor, GetLang _getLang)
 {
     _logger              = logger;
     this._listFactory    = listFactory;
     _providersHandler    = providersHandler;
     _httpContextAccessor = httpContextAccessor;
     getLang              = _getLang;
     langcode             = getLang.GetLanguage();
 }
        public string getAllProviders()
        {
            List <GET_ALL_PROVIDERSResult> providers = null;

            try
            {
                ProvidersHandler handler = new ProvidersHandler();

                providers = handler.getAllProviders();
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new ReturnObject <string>(ErrorConstants.ERROR_EXCEPTION, ex.Message)));
            }
            if (providers != null)
            {
                return(JsonConvert.SerializeObject(new ReturnObject <List <GET_ALL_PROVIDERSResult> >(ErrorConstants.SUCCESS, providers)));
            }
            else
            {
                return(JsonConvert.SerializeObject(new ReturnObject <string>(ErrorConstants.ERROR_NO_PROVIDERS_FOUND, ErrorConstants.ERROR_NO_PROVIDERS_FOUND_MSG)));
            }
        }