public async Task <IActionResult> GetSuggestionLists([FromQuery] SuggestionListParameter suggestionListsParameters)
        {
            var getAllSuggestionListsQuery = new GetAllSuggestionListsQuery(suggestionListsParameters);
            var result = await mediator.Send(getAllSuggestionListsQuery);

            if (result.Code == HttpStatusCode.OK)
            {
                Response.Headers.Add("X-Pagination", PagedList <Entity> .ToJson(result.Value as PagedList <Entity>));
            }

            return(StatusCode((int)result.Code, result.Value));
        }
Exemple #2
0
        /// <summary>
        /// Gets all subscriptionPlan.
        /// </summary>
        /// <param name="subscriptionPlansParameter">The story parameters.</param>
        /// <returns></returns>
        public async Task <PagedList <Entity> > GetAllSuggestionLists(SuggestionListParameter suggestionListParameter)
        {
            {
                var getSubscriptionsParams = new object[] {
                    new MySqlParameter("@p_IsForVendor", suggestionListParameter.IsForVendor),
                    new MySqlParameter("@p_IsForSubscription", suggestionListParameter.IsForSubscription),
                    new MySqlParameter("@p_IsForSingleSuggestion", suggestionListParameter.IsForSingleSuggestion),
                    new MySqlParameter("@p_Value", suggestionListParameter.Value),
                    new MySqlParameter("@p_ApprovalStatus", suggestionListParameter.ApprovalStatus)
                };
                var subscriptions = await FindAll("CALL SpSelectActiveSuggestionlist(@p_IsForVendor, @p_IsForSubscription,@p_IsForSingleSuggestion, @p_Value, @p_ApprovalStatus)", getSubscriptionsParams).ToListAsync();

                var mappedSubscriptions = subscriptions.AsQueryable().ProjectTo <SuggestionListResponse>(mapper.ConfigurationProvider);
                var sortedSubscriptions = sortHelper.ApplySort(mappedSubscriptions, suggestionListParameter.OrderBy);
                var shapedSubscriptions = dataShaper.ShapeData(sortedSubscriptions, suggestionListParameter.Fields);

                return(await PagedList <Entity> .ToPagedList(shapedSubscriptions, suggestionListParameter.PageNumber, suggestionListParameter.PageSize));
            }
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetAllSubscriptionplansQuery"/> class.
 /// </summary>
 /// <param name="suggestionListParameter">The SuggestionList parameters.</param>
 public GetAllSuggestionListsQuery(SuggestionListParameter suggestionListParameter)
 {
     SuggestionListParameter = suggestionListParameter;
 }
        public async Task <IActionResult> GetSuggestionLists([FromQuery] SuggestionListParameter suggestionListsParameters)
        {
            var result = await suggestionlistService.GetSuggestionLists(suggestionListsParameters);

            return(StatusCode((int)result.Code, result.Value));
        }
 public Task <APIResponse> GetSuggestionLists(SuggestionListParameter suggestionListsParameters)
 {
     throw new NotImplementedException();
 }