protected override void Initialize(System.Web.Routing.RequestContext requestContext) { try { #region Validation for multiple session var commmonsetup = SystemBusinessInstance.GetCommonSetup(0, null, Convert.ToString((int)AspectEnums.CommonTableMainType.Template)); // DBEntities.CommonSetups.Where(x => x.ParentID == 1).ToList(); //var templates = DBEntities.TemplateMasters.Where(x => x.TemplateType == (int)AspectEnums.TemplateType.Wedding && x.TemplateStatus == 1).ToList(); List <TemplateMasterBO> templates = SystemBusinessInstance.GetAllTemplates((int)AspectEnums.TemplateType.Wedding); foreach (var item in templates) { StringBuilder tagName = new StringBuilder(); StringBuilder feature = new StringBuilder(); StringBuilder tagid = new StringBuilder(); foreach (var tag in item.TemplateTags.Split(',')) { string strtag = commmonsetup.Where(x => x.SubType == "Tag" && x.DisplayValue == Convert.ToInt32(tag)).First().DisplayText; tagName.Append(strtag).Append(',').Append(' '); } item.TemplateTagName = tagName.ToString().Trim(',').Trim(' '); if (item.Features != null) { foreach (var tempfeature in item.Features.Split(',')) { string strfeature = commmonsetup.Where(x => x.SubType == "Features" && x.DisplayValue == Convert.ToInt32(tempfeature)).First().DisplayText; feature.Append(strfeature).Append(',').Append(' '); } item.TemplateFeatureText = feature.ToString().Trim(',').Trim(' '); } item.TemplateTypeText = commmonsetup.Where(x => x.SubType == "Type" && x.DisplayValue == item.TemplateType).First().DisplayText; } dreamweddsModel.templateMasters = templates; WebTemplates = templates; if (WebTemplates != null) { requestContext.HttpContext.Session["Templates"] = WebTemplates; } #endregion WebBlogs = WeddingBusinessInstance.GetDreamWeddsBlog(); dreamweddsModel.blogs = WebBlogs; if (WebBlogs != null) { requestContext.HttpContext.Session["Blogs"] = dreamweddsModel.blogs; } base.Initialize(requestContext); } catch (Exception ex) { throw ex; } }
public DreamweddsModel GetWebsiteData() { DreamweddsModel dreamweddsModel = new DreamweddsModel(); try { #region Validation for multiple session var commmonsetup = SystemBusinessInstance.GetCommonSetup(0, null, Convert.ToString((int)AspectEnums.CommonTableMainType.Template));// DBEntities.CommonSetups.Where(x => x.ParentID == 1).ToList(); var templates = SystemBusinessInstance.GetAllTemplates(null); foreach (var item in templates.Where(x => x.TemplateType == (int)AspectEnums.TemplateType.Wedding)) { StringBuilder tagName = new StringBuilder(); StringBuilder feature = new StringBuilder(); StringBuilder tagid = new StringBuilder(); //foreach (var tag in item.TemplateTags.Split(',')) //{ // string strtag = commmonsetup.Where(x => x.SubType == "Tag" && x.DisplayValue == Convert.ToInt32(tag)).First().DisplayText; // tagName.Append(strtag).Append(',').Append(' '); //} // item.TemplateTagName = tagName.ToString().Trim(',').Trim(' '); if (item.Features != null) { foreach (var tempfeature in item.Features.Split(',')) { string strfeature = commmonsetup.Where(x => x.SubType == "Features" && x.DisplayValue == Convert.ToInt32(tempfeature)).FirstOrDefault().DisplayText; feature.Append(strfeature).Append(',').Append(' '); } item.TemplateFeatureText = feature.ToString().Trim(',').Trim(' '); } item.TemplateTypeText = commmonsetup.Where(x => x.SubType == "Type" && x.DisplayValue == item.TemplateType).First().DisplayText; } dreamweddsModel.templateMasters = templates; Templates = templates; #endregion Blogs = WeddingBusinessInstance.GetDreamWeddsBlog(); dreamweddsModel.blogs = Blogs; Faqs = WeddingBusinessInstance.GetDreamWeddsFAQ(); dreamweddsModel.faqs = Faqs; } catch (Exception ex) { throw ex; } DreamWeddsWeb = dreamweddsModel; return(dreamweddsModel); }