Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #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()));
 }
Beispiel #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()));
 }
Beispiel #5
0
 public static CustomResponse WithProductTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("productTypes", SelectListHelper.GetSelectItemList <ProductType>()));
 }
Beispiel #6
0
 public static CustomResponse WithTimeCycles(this CustomResponse customResponse)
 {
     return(customResponse.With("timeCycles", SelectListHelper.GetSelectItemList <TimeCycle>()));
 }
Beispiel #7
0
 public static CustomResponse WithWeightUnits(this CustomResponse customResponse)
 {
     return(customResponse.With("weightUnits", SelectListHelper.GetSelectItemList <WeightUnit>()));
 }
Beispiel #8
0
 public static CustomResponse WithAvailablePaymentStatusTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("paymentStatusTypes", SelectListHelper.GetPaymentStatusItems()));
 }
Beispiel #9
0
 public static CustomResponse WithRoundingTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("roundingTypes", SelectListHelper.GetSelectItemList <Rounding>()));
 }
Beispiel #10
0
 public static CustomResponse WithCultures(this CustomResponse customResponse)
 {
     return(customResponse.With("cultures", SelectListHelper.GetCultures()));
 }
Beispiel #11
0
 public static CustomResponse WithAllFlags(this CustomResponse customResponse)
 {
     return(customResponse.With("countryFlags", SelectListHelper.GetAvailableFlags()));
 }
Beispiel #12
0
 public static CustomResponse WithEmailAccounts(this CustomResponse customResponse)
 {
     return(customResponse.With("emailAccounts", SelectListHelper.GetAvailableEmailAccounts()));
 }
Beispiel #13
0
 public static CustomResponse WithCatalogPaginationTypes(this CustomResponse customResponse)
 {
     return(customResponse.With("catalogPaginationTypes", SelectListHelper.GetSelectItemList <CatalogPaginationType>()));
 }
Beispiel #14
0
 public static CustomResponse WithRegistrationModes(this CustomResponse customResponse)
 {
     return(customResponse.With("registrationModes", SelectListHelper.GetSelectItemList <RegistrationMode>()));
 }
Beispiel #15
0
 public static CustomResponse WithTimezones(this CustomResponse customResponse)
 {
     return(customResponse.With("timezones", SelectListHelper.GetTimezones()));
 }
Beispiel #16
0
 public static CustomResponse WithLengthUnits(this CustomResponse customResponse)
 {
     return(customResponse.With("lengthUnits", SelectListHelper.GetSelectItemList <LengthUnit>()));
 }
Beispiel #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()));
 }
Beispiel #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));
 }