Beispiel #1
0
        /// <summary>
        /// Gets the budgeter by identifier.
        /// </summary>
        /// <param name="budgeterId">The budgeter identifier.</param>
        /// <returns></returns>
        public async Task <APIResponse> GetBudgeterById(int budgeterId)
        {
            try
            {
                var client   = httpClientFactory.CreateClient(ECommerceServiceOperation.serviceName);
                var response = await client.GetAsync(servicesConfig.EventAssistant + EventAssistantServiceOperation.GetBudgeterById(budgeterId));

                if (response.IsSuccessStatusCode)
                {
                    var multicode = JsonConvert.DeserializeObject <BudgeterResponse>(await response.Content.ReadAsStringAsync());
                    return(new APIResponse(multicode, HttpStatusCode.OK));
                }

                return(new APIResponse(response.StatusCode));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'GetMultiCodeById()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }