public ActionResult Management() { var service = _iCouponService; var vshop = _iVShopService; var userCouponList = service.GetUserCouponList(CurrentUser.Id); var shopBonus = _iShopBonusService.GetDetailByUserId(CurrentUser.Id); if (userCouponList == null && shopBonus == null) { throw new Himall.Core.HimallException("没有领取记录!"); } else { var couponlist = userCouponList.ToArray().Select(a => new UserCouponInfo { UserId = a.UserId, ShopId = a.ShopId, CouponId = a.CouponId, Price = a.Price, PerMax = a.PerMax, OrderAmount = a.OrderAmount, Num = a.Num, StartTime = a.StartTime, EndTime = a.EndTime, CreateTime = a.CreateTime, CouponName = a.CouponName, UseStatus = a.UseStatus, UseTime = a.UseTime, VShop = vshop.GetVShopByShopId(a.ShopId) }); int NoUseCount = couponlist.Count(item => (item.EndTime > DateTime.Now && item.UseStatus == CouponRecordInfo.CounponStatuses.Unuse)); int bonusNoUseCount = shopBonus.Count(p => p.State == ShopBonusReceiveInfo.ReceiveState.NotUse && p.Himall_ShopBonusGrant.Himall_ShopBonus.BonusDateEnd > DateTime.Now); ViewBag.NoUseCount = NoUseCount + bonusNoUseCount; ViewBag.UserCount = (userCouponList.Count() + shopBonus.Count()) - ViewBag.NoUseCount; ViewBag.ShopBonus = shopBonus; return(View(couponlist)); } }
public static List <ShopBonusReceiveInfo> GetDetailByUserId(long userid) { return(_iShopBonusService.GetDetailByUserId(userid)); }