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