Ejemplo n.º 1
0
        public PartialViewResult PrizeView(string ticket)
        {
            var _mp = _db.Member_Prize.SingleOrDefault(x => x.Ticket.Equals(ticket));

            if (_mp == null)
            {
                //未中奖时返回的视图
                return(PartialView("~/Views/Home/DstBox/_Thank.cshtml"));
            }

            var _prize = _db.Prizes.Find(_mp.PrizeID);

            if (_prize != null)
            {
                switch (_prize.Name)
                {
                case "未中奖":
                    return(PartialView("~/Views/Home/DstBox/_Thank.cshtml"));

                case "五等奖":
                    var member            = _db.Members.Find(_mp.MemberID);
                    LogPrizeInfoAsync log = LogPrizeInfo;
                    log.BeginInvoke(_mp, member, "", "", LogPrizeInfoCallBack, log);

                    ViewBag.Prize = "50元优惠券";
                    ViewBag.Href  = "http://taoquan.taobao.com/coupon/unify_apply.htm?sellerId=821406630&activityId=8b79fc9de8bb46d8b52352bf206c8754";
                    return(PartialView("~/Views/Home/DstBox/_Cash.cshtml"));

                case "六等奖":
                    member = _db.Members.Find(_mp.MemberID);
                    log    = LogPrizeInfo;
                    log.BeginInvoke(_mp, member, "", "", LogPrizeInfoCallBack, log);

                    ViewBag.Prize = "20元优惠券";
                    ViewBag.Href  = "http://taoquan.taobao.com/coupon/unify_apply.htm?sellerId=821406630&activityId=f18c63a434c44466aebce3c0e27f6a74";
                    return(PartialView("~/Views/Home/DstBox/_Cash.cshtml"));

                default:
                    ViewBag.Ticket = ticket;
                    return(PartialView("~/Views/Home/DstBox/_Receive.cshtml", _prize));
                }
            }

            throw new Exception("抱歉,程序貌似出错了");
        }
Ejemplo n.º 2
0
        public JsonResult ReceivePrize(string Ticket, string Name, string Address)
        {
            var mp = _db.Member_Prize.SingleOrDefault(x => x.Ticket.Equals(Ticket));

            if (mp == null)
            {
                return(Json(new { result = false, msg = "找不到您的中奖信息,请联系我们的客服。" }));
            }

            var member = _db.Members.Find(mp.MemberID);

            if (member == null)
            {
                return(Json(new { result = false, msg = "找不到您的用户信息,请联系我们的客服。" }));
            }
            LogPrizeInfoAsync log = LogPrizeInfo;

            log.BeginInvoke(mp, member, Name, Address, LogPrizeInfoCallBack, log);

            return(Json(new { result = true }));
        }