string GetStatusValue(ResellerStatus status) { switch (status) { case ResellerStatus.Active: return("A"); case ResellerStatus.Inactive: return("P"); case ResellerStatus.Suspend: return("S"); case ResellerStatus.All: return(null); } return(null); }
public Result <PagedReseller> SearchReseller(int pageNo, int pageSize, ResellerSearchOrderBy orderBy, string name, ResellerStatus status) { IList <string> validationErrs = ValidatePageSizeAndPageNo(pageSize, pageNo); if (validationErrs.Count > 0) { return(new Result <PagedReseller>(validationErrs)); } RestRequest request = new RestRequest(SEARCH_RESELLER_URL, Method.GET); request.AddParameter(Constants.PAGINATION_PAGE_NO, pageNo.ToString()); request.AddParameter(Constants.PAGINATION_PAGE_LIMIT, pageSize.ToString()); request.AddParameter("orderBy", GetOrderValue(orderBy)); request.AddParameter("name", name); request.AddParameter("status", GetStatusValue(status)); var responseContent = Execute(request); ResellerPageResponse resellerPage = JsonConvert.DeserializeObject <ResellerPageResponse>(responseContent); Result <PagedReseller> result = new Result <PagedReseller>(resellerPage); return(result); }