public ActionResult Close(Guid promoid)
        {
            AccountBase.SetupActionAccount();
            var busy = AccountBase.BusinessActions.GetBusinessForUser(this.AccountBase.Account);
            List <PraLoup.DataAccess.Entities.Business> busies = new List <DataAccess.Entities.Business>(busy);

            //
            // we should have some ui and state that tells which business the user is working on.
            //
            PraLoup.DataAccess.Entities.Business business = busies[0];

            var pcm = new BusinessModels.PromotionCloseModel();

            pcm.Promotion = AccountBase.PromotionActions.GetPromotion(promoid);
            var invites = AccountBase.PromotionInstanceActions.GetUserInvitesForPromotion(pcm.Promotion);

            pcm.UserCloseData = new List <BusinessModels.UserCloseData>();
            foreach (var invite in invites)
            {
                var ucd = new BusinessModels.UserCloseData();
                ucd.Invite     = invite;
                ucd.Rating     = new BusinessModels.StarModel();
                ucd.Rating.Max = 10;
                if (ucd.Invite.UserRatings.Count > 0)
                {
                    ucd.Rating.Value = ucd.Invite.UserRatings[0].Rate;
                    ucd.AmountSpent  = ucd.Invite.UserRatings[0].AmountSpent.Value;
                }
                ucd.Redeemed   = ucd.Invite.IsAttended;
                ucd.UserGroups = AccountBase.UserGroupActions.GetUserGroupsForBusinessAndUser(ucd.Invite.Recipient, business);
                pcm.UserCloseData.Add(ucd);
            }

            return(View(pcm));
        }
Beispiel #2
0
 public Promotion(Business business, Event ev, IList<Deal> deals, int available, byte maxReferal)
 {
     this.Business = business;
     this.Event = ev;
     this.Deals = deals;
     this.Available = available;
     this.MaxReferal = maxReferal;
 }
Beispiel #3
0
 public static Business GetBusiness(string businessName, Category businessCategory)
 {
     var b = new Business()
     {
         Name = businessName,
         Category = businessCategory,
         Phone = "1231231234",
         Url = "http://abc.abc.com",
         Address = GetRandomAddress()
     };
     return b;
 }
Beispiel #4
0
 public Promotion(Business business, Event ev, Deal deal, int available, byte maxReferal)
     : this(business, ev, new Deal[] { deal }, available, maxReferal)
 {
 }
Beispiel #5
0
 public static Promotion GetPromo(Business b, Event ev, Deal d)
 {
     return new Promotion(b, ev, d, 100, 5);
 }