Exemple #1
0
        public async Task <ApiPromotionResultResponse> GetPromotionResult([FromUri] int promotionTypeId, int?promotionCategoryId = null)
        {
            var apiResp = new ApiPromotionResultResponse {
                ResponseType = -1, ResponseMessage = "Failed"
            };

            var retVal = await _promotion.GetPromotionTypeResult(promotionTypeId, promotionCategoryId);

            if (retVal.Count > 0)
            {
                apiResp.ResponseObject = new List <PromotionResult>();
                int count = 1;
                foreach (var _promo in retVal)
                {
                    var promotion = new PromotionResult();
                    promotion.Bind(_promo);
                    promotion.PromoNumber = count;
                    apiResp.ResponseObject.Add(promotion);
                    count++;
                }
                apiResp.ResponseObject.OrderByDescending(x => x.NumberOfVotes);
                apiResp.ResponseType    = 1;
                apiResp.ResponseMessage = "Success";
            }
            return(apiResp);
        }