public ActionResult ReportWelcomeEmail(ReportEmailVM model) { int siteID = model.SiteId; model.Referrers = SitesManager.GetReferrers(); model.Sites = SitesManager.GetSites(); //using (CastleClub.BusinessLogic.Data.CastleClubEntities entities = new BusinessLogic.Data.CastleClubEntities()) //{ i //int i = 0; model.delayDef = new int[] { 0, 1, 2, 3, 7 }; model.delayEmailSent = new int[model.delayDef.Max() + 1, SitesManager.GetMaxID() + 1]; model.delayActiveUsers = new int[model.delayDef.Max() + 1, SitesManager.GetMaxID() + 1]; model.delayCancelledUsers = new int[model.delayDef.Max() + 1, SitesManager.GetMaxID() + 1]; foreach (var item in model.Sites) { //get total of email sent foreach (var delay in model.delayDef.ToList()) { if ((model.SiteId == item.Id) || model.SiteId == 0) { model.delayEmailSent[delay, item.Id] = SitesManager.WelcomeEmailsSent(model.StartDate, model.EndDate, item.Id, model.ReferrerId, delay); model.delayActiveUsers[delay, item.Id] = SitesManager.WelcomeEmailsSentActive(model.StartDate, model.EndDate, item.Id, model.ReferrerId, delay); model.delayCancelledUsers[delay, item.Id] = SitesManager.WelcomeEmailsSentCancelled(model.StartDate, model.EndDate, item.Id, model.ReferrerId, delay); } } } //} return(View(model)); }