예제 #1
0
        public static CustomResponse WithAvailableStores(this CustomResponse customResponse,
                                                         IList <int> selectedStores = null)
        {
            var availableStores = SelectListHelper.GetAvailableStores().Select(x =>
            {
                if (selectedStores?.Any(y => y.ToString() == x.Value) ?? false)
                {
                    x.Selected = true;
                }
                return(x);
            }).ToList();

            return(customResponse.With("availableStores", availableStores));
        }
예제 #2
0
        public static CustomResponse WithGridResponse(this CustomResponse customResponse, int totalMatches, int currentPage, int count, string sortBy = null, SortOrder?sortOrder = null)
        {
            if (currentPage < 1)
            {
                currentPage = 1;
            }
            count = Math.Min(count, totalMatches);
            var r = customResponse.With("current", currentPage)
                    .With("rowCount", count)
                    .With("rangeStart", (currentPage - 1) * count + 1)
                    .With("rangeEnd", currentPage * count)
                    .With("total", totalMatches);

            if (!sortBy.IsNullEmptyOrWhiteSpace())
            {
                r.With("sortBy", sortBy);
            }
            if (sortOrder.HasValue)
            {
                r.With("sortOrder", sortOrder.Value);
            }
            return(r);
        }
예제 #3
0
 /// <summary>
 /// Adds available address types to current response
 /// </summary>
 /// <param name="customResponse">The response object</param>
 /// <returns></returns>
 public static CustomResponse WithAvailableAddressTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("availableAddressTypes", SelectListHelper.GetAddressTypes()));
 }
예제 #4
0
 /// <summary>
 /// Adds available countries to current response
 /// </summary>
 /// <param name="customResponse">The response object</param>
 /// <returns></returns>
 public static CustomResponse WithAvailableCountries(this CustomResponse customResponse)
 {
     return(customResponse.With("availableCountries", SelectListHelper.GetCountries()));
 }
예제 #5
0
 public static CustomResponse WithProductTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("productTypes", SelectListHelper.GetSelectItemList <ProductType>()));
 }
예제 #6
0
 public static CustomResponse WithTimeCycles(this CustomResponse customResponse)
 {
     return(customResponse.With("timeCycles", SelectListHelper.GetSelectItemList <TimeCycle>()));
 }
예제 #7
0
 public static CustomResponse WithWeightUnits(this CustomResponse customResponse)
 {
     return(customResponse.With("weightUnits", SelectListHelper.GetSelectItemList <WeightUnit>()));
 }
예제 #8
0
 public static CustomResponse WithAvailablePaymentStatusTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("paymentStatusTypes", SelectListHelper.GetPaymentStatusItems()));
 }
예제 #9
0
 public static CustomResponse WithRoundingTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("roundingTypes", SelectListHelper.GetSelectItemList <Rounding>()));
 }
예제 #10
0
 public static CustomResponse WithCultures(this CustomResponse customResponse)
 {
     return(customResponse.With("cultures", SelectListHelper.GetCultures()));
 }
예제 #11
0
 public static CustomResponse WithAllFlags(this CustomResponse customResponse)
 {
     return(customResponse.With("countryFlags", SelectListHelper.GetAvailableFlags()));
 }
예제 #12
0
 public static CustomResponse WithEmailAccounts(this CustomResponse customResponse)
 {
     return(customResponse.With("emailAccounts", SelectListHelper.GetAvailableEmailAccounts()));
 }
예제 #13
0
 public static CustomResponse WithCatalogPaginationTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("catalogPaginationTypes", SelectListHelper.GetSelectItemList <CatalogPaginationType>()));
 }
예제 #14
0
 public static CustomResponse WithRegistrationModes(this CustomResponse customResponse)
 {
     return(customResponse.With("registrationModes", SelectListHelper.GetSelectItemList <RegistrationMode>()));
 }
예제 #15
0
 public static CustomResponse WithTimezones(this CustomResponse customResponse)
 {
     return(customResponse.With("timezones", SelectListHelper.GetTimezones()));
 }
예제 #16
0
 public static CustomResponse WithLengthUnits(this CustomResponse customResponse)
 {
     return(customResponse.With("lengthUnits", SelectListHelper.GetSelectItemList <LengthUnit>()));
 }
예제 #17
0
 /// <summary>
 /// Adds available input types to current response
 /// </summary>
 /// <param name="customResponse">The response object</param>
 /// <returns></returns>
 public static CustomResponse WithAvailableInputTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("inputTypes", SelectListHelper.GetInputTypes()));
 }
예제 #18
0
 /// <summary>
 /// Adds available input types to current response
 /// </summary>
 /// <param name="customResponse">The response object</param>
 /// <param name="paramsModel"></param>
 /// <returns></returns>
 public static CustomResponse WithParams(this CustomResponse customResponse, object paramsModel)
 {
     return(customResponse.With("params", paramsModel));
 }