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