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); }
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)); }