/// <summary> /// Retrieves the pagination size for the ingredient view. /// </summary> /// <param name="ingredientName"> The name of the ingredients used for searching.</param> /// <param name="storeId"> Store id used to find the correct store. </param> /// <param name="failurecount"> Current number of times this operation has failed.</param> /// <param name="username"> Username of person requesting operation for logging.</param> /// <param name="ipAddress"> IP address of system requesting operation for logging.</param> /// <returns> Integer holding the number of a certain ingredient at a specific store. </returns> public async Task <int> GetIngredientViewPaginationSize(string ingredientName, int storeId, int failurecount, string username, string ipAddress) { try { var uploads = await _uploadService.GetIngredientViewPaginationSize(ingredientName, storeId).ConfigureAwait(false); _ = _loggingManager.LogAsync(DateTime.UtcNow.ToString(Constants.LoggingFormatString), Constants.GetIngredientViewPaginationSizeOperation, username, ipAddress).ConfigureAwait(false); return(uploads); } catch (Exception e) { _ = _loggingManager.LogAsync(DateTime.UtcNow.ToString(Constants.LoggingFormatString), Constants.GetIngredientViewPaginationSizeOperation, username, ipAddress).ConfigureAwait(false); failurecount += 1; if (failurecount >= Constants.LoggingRetriesAmount) { throw e; } else { return(await _uploadService.GetIngredientViewPaginationSize(ingredientName, storeId).ConfigureAwait(false)); } } }