/// <summary> /// Returns an enumerator that iterates through all application keys associated with an account. /// </summary> /// <param name="request">The <see cref="ListKeysRequest"/> to send.</param> /// <param name="cacheTTL">An absolute cache expiration time to live (TTL) relative to now.</param> /// <exception cref="AuthenticationException">Thrown when authentication fails.</exception> /// <exception cref="ApiException">Thrown when an error occurs during client operation.</exception> async Task <IEnumerable <KeyItem> > IStorageKeys.GetEnumerableAsync (ListKeysRequest request, TimeSpan cacheTTL) { var enumerable = new KeyEnumerable(_client, _logger, request, cacheTTL, _cancellationToken) as IEnumerable <KeyItem>; return(await Task.FromResult(enumerable).ConfigureAwait(false)); }
///// <summary> ///// Get invalid data for given model in json result. ///// </summary> ///// <typeparam name="T"></typeparam> ///// <param name="modelKeys"></param> ///// <returns>JsonResult</returns> //public JsonResult GetInvalidParametersJsonResult<T>(KeyEnumerable modelKeys = default(KeyEnumerable)) //{ // #region Declare a return type with initial value. // JsonResult jsonResult = null; // #endregion // try // { // if (!modelKeys.Equals(default(KeyEnumerable))) // { // jsonResult = JsonResultResponse($"{string.Format(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidData, CurrentLanguagId), $"[{string.Join(", ", modelKeys)}]")}", Activator.CreateInstance<T>(), HttpStatusCode.BadRequest); // } // else // { // jsonResult = JsonResultResponse($"{string.Format(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidParameters, CurrentLanguagId), string.Empty)}", Activator.CreateInstance<T>(), HttpStatusCode.BadRequest); // } // } // catch (System.Exception exception) // { // Logger.Instance.LogException(exception, CurrentUserId.ToString(), MethodBase.GetCurrentMethod(), DateTime.Now.ToShortTimeString(), LogLevel.Medium); // } // return jsonResult; //} public JsonResult GetInvalidParametersJsonResult <T>(KeyEnumerable modelKeys = default(KeyEnumerable)) { #region Declare a return type with initial value. JsonResult jsonResult = null; #endregion try { if (!modelKeys.Equals(default(KeyEnumerable))) { jsonResult = JsonResultResponse($"{string.Format(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidData, CurrentLanguagId), $"[{string.Join(", ", modelKeys)}]")}", Activator.CreateInstance <T>(), HttpStatusCode.BadRequest); } else { jsonResult = JsonResultResponse($"{string.Format(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidParameters, CurrentLanguagId), string.Empty)}", Activator.CreateInstance <T>(), HttpStatusCode.OK, APIResponseMessage.InternalServerError); } } catch (System.Exception exception) { Logger.Instance.LogException(exception, CurrentUserId.ToString(), MethodBase.GetCurrentMethod(), DateTime.Now.ToShortTimeString(), LogLevel.Medium); } return(jsonResult); }