public ActionResult Index(int? page) { ArticleListModel model = new ArticleListModel(); PageModel.Title = ""; PageModel.Description = ""; PageModel.Author = ""; PageModel.Keywords = ""; //ListAccess la = new ListAccess(); //model.MostViewed = la.MostViewed(11, 20); string url = HttpContext.Request.RawUrl; //int catigoryRowId = DIYFEHelper.GetCatigoryRowId(url); //model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(catigoryRowId, linkPrefix); using (var db = new DIYFE.EF.DIYFEEntities()) { // model.ProjectList = db.Articles.Where(a => a.ArticleTypeId == 2).OrderBy(a => a.ArticleStatus.Any(aStat => aStat.StatusId == 1)).ToList(); //model.ArticleList = db.Articles.Include("ArticleComments").Where(a => a.ArticleTypeId == 4).OrderBy(a => a.CreatedDate).ToList(); model.PagedArticle = db.Articles.Include("ArticleComments").Where(a => a.ArticleTypeId == 4).OrderBy(a => a.CreatedDate).ToPagedList(page ?? 1, pageSize); } //model.ArticleList = la.ArticleList(catigoryId, 1); return View(model); }
public ActionResult ArticleList(string articleType, string categoryUrl, string subCategoryUrl, string subSubCategoryUrl, int? page) { ArticleListModel model = new ArticleListModel(); PageModel.Title = ""; PageModel.Description = ""; PageModel.Author = ""; PageModel.Keywords = ""; string url = HttpContext.Request.RawUrl; //int categoryRowId = DIYFEHelper.GetCatigoryRowId(categoryUrl, "", ""); Category cat = StaticConfig.GetCatigory(categoryUrl, subCategoryUrl, subSubCategoryUrl); model.CrumbLinkList = StaticConfig.GenerateCrumbLinks(cat, articleType); model.RelatedTreeView = StaticConfig.GenerateRelatedTreeView(cat, articleType); model.PageLinkBase = StaticConfig.BaseSiteUrl + articleType; if (categoryUrl != ""){ model.PageLinkBase += "/" + cat.CategoryUrl; } if (subCategoryUrl != "") { model.PageLinkBase += "/" + cat.SecondLevCategoryUrl; } if (subSubCategoryUrl != "") { model.PageLinkBase += "/" + cat.ThirdLevCategoryUrl; } //model.PageLinkBase = model.CrumbLinkList.Last().Href; //model.RelatedTreeView = StaticConfig.TreeView(cat, model.PageLinkBase); using (var db = new DIYFE.EF.DIYFEEntities()) { //BASED ON CAT //model.ArticleList = db.Articles.Include("ArticleComments").Where(a => a.Category.CategoryId == cat.CategoryId).OrderBy(a => a.CreatedDate); if (categoryUrl != "") { model.PagedArticle = db.Articles.Include("ArticleComments").Include("ArticleStatus.StatusType").Where(a => a.Category.CategoryId == cat.CategoryId && a.ArticleStatus.Any(aStat => aStat.StatusId == 1)).OrderByDescending(a => a.CreatedDate).ToPagedList(page ?? 1, pageSize); //model.PagedArticle = db.Articles.Include("ArticleComments").Include("ArticleStatus.StatusType").Where(a => a.ArticleStatus.Any(aStat => aStat.StatusId == 1)).OrderByDescending(a => a.CreatedDate).ToPagedList(page ?? 1, pageSize); if (subSubCategoryUrl != "") { model.Into = db.Articles.Where(a => a.URLLink == subSubCategoryUrl).FirstOrDefault(); } else if (subCategoryUrl != "") { model.Into = db.Articles.Where(a => a.URLLink == subCategoryUrl).FirstOrDefault(); } else { model.Into = db.Articles.Where(a => a.URLLink == categoryUrl).FirstOrDefault(); } } else { model.PagedArticle = db.Articles.Include("ArticleComments").Include("ArticleStatus.StatusType").Where(a => a.ArticleType.ArticleTypeName == articleType && a.ArticleStatus.Any(aStat => aStat.StatusId == 1)).OrderByDescending(a => a.CreatedDate).ToPagedList(page ?? 1, pageSize); } model.Into = new Article(); model.Into.Title = "Text of H1 in work"; //CHECK PAGING //model.ArticleList = db.Articles.Include("ArticleComments").Where(a => a.ArticleTypeId == 1); //model.PagedArticle = model.ArticleList.Concat(db.Articles.Include("ArticleComments").Include("ArticleStatus.StatusType").Where(a => a.ArticleTypeId == 2)).OrderBy(a => a.CreatedDate).ToPagedList(page ?? 1, pageSize); } //model.PagedArticle = model.ArticleList.ToPagedList(page ?? 1, pageSize); return View(model); }
public ActionResult Index() { ArticleListModel model = new ArticleListModel(); using (var db = new DIYFE.EF.DIYFEEntities()) { // model.ProjectList = db.Articles.Include("ArticleStatus").OrderBy(a => a.UpdateDate).Take(5).ToList(); //Projects needing funding model.ArticleList = db.Articles.Include("ArticleStatus").ToList(); //model.ProjectList = db.Articles.Include("ArticleStatus").Where(a => a.ArticleStatus.Any(arts => arts.StatusId == 4)).Take(5).ToList(); ////Projects recently updated //model.ProjectList.AddRange(db.Articles.Include("ArticleStatus").Where(a => a.ArticleTypeId == 2).OrderBy(a => a.UpdateDate).Take(5).ToList()); ////Post recently added //model.ProjectList.AddRange(db.Articles.Include("ArticleStatus").Where(a => a.ArticleTypeId == 1).OrderBy(a => a.CreatedDate).Take(5).ToList()); ////News recently added //model.ProjectList.AddRange(db.Articles.Include("ArticleStatus").Where(a => a.ArticleTypeId == 4).OrderBy(a => a.CreatedDate).Take(5).ToList()); ////model.ProjectList = db.Articles.Include() ////var articles = db.Articles.Where(a => a.ArticleTypeId == 2 && a.ArticleStatus.Any(ar => ar.StatusId==3)); } return View(model); }
public ActionResult Search(string searchVal, int? page) { ArticleListModel model = new ArticleListModel(); PageModel.Title = ""; PageModel.Description = searchVal; PageModel.Author = ""; PageModel.Keywords = ""; // string url = HttpContext.Request.RawUrl; //int categoryRowId = DIYFEHelper.GetCatigoryRowId(categoryUrl, "", ""); using (var db = new DIYFE.EF.DIYFEEntities()) { //BASED ON CAT //mo model.PagedArticle = db.Articles.Include("ArticleComments").Include("ArticleStatus.StatusType").Where(a => a.ArticleType.ArticleTypeName == "post" && a.ArticleStatus.Any(aStat => aStat.StatusId == 1)).OrderByDescending(a => a.CreatedDate).ToPagedList(page ?? 1, 10); //CHECK PAGING //model.ArticleList = db.Articles.Include("ArticleComments").Where(a => a.ArticleTypeId == 1); //model.PagedArticle = model.ArticleList.Concat(db.Articles.Include("ArticleComments").Include("ArticleStatus.StatusType").Where(a => a.ArticleTypeId == 2)).OrderBy(a => a.CreatedDate).ToPagedList(page ?? 1, pageSize); } //model.PagedArticle = model.ArticleList.ToPagedList(page ?? 1, pageSize); return View(model); }
public ActionResult Index() { ArticleListModel model = new ArticleListModel(); model.ProjectList = new List<DIYFE.EF.Article>(); using (var db = new DIYFE.EF.DIYFEEntities()) { // model.ProjectList = db.Articles.Include("ArticleStatus").OrderBy(a => a.UpdateDate).Take(5).ToList(); //Projects needing funding model.ProjectList = db.Articles.Include("ArticleStatus").Where(a => a.ArticleStatus.Any(arts => arts.StatusId == 4)).Take(5).ToList(); //Projects recently updated model.ProjectList.AddRange(db.Articles.Include("ArticleStatus").Where(a => a.ArticleTypeId == 2).OrderBy(a => a.UpdateDate).Take(5).ToList()); //Post recently added model.ProjectList.AddRange(db.Articles.Include("ArticleStatus").Where(a => a.ArticleTypeId == 1).OrderBy(a => a.CreatedDate).Take(5).ToList()); //News recently added model.ProjectList.AddRange(db.Articles.Include("ArticleStatus").Where(a => a.ArticleTypeId == 4).OrderBy(a => a.CreatedDate).Take(5).ToList()); //model.ProjectList = db.Articles.Include() //var articles = db.Articles.Where(a => a.ArticleTypeId == 2 && a.ArticleStatus.Any(ar => ar.StatusId==3)); } model.ProjectList = model.ProjectList.Distinct().ToList(); PageModel.Title = "DiyFe"; PageModel.Description = ""; PageModel.Author = "Do it yourself for everyone."; PageModel.Keywords = "DIY, DIYFE, do it yourself, homesteading, transition"; //PageModel.ActiveTopNavLink = "MainNavHome"; //Test error handeling //throw new Exception(); #region Check Valid Domain and Email //EmailValidation.Validate validate = new EmailValidation.Validate(); //EmailValidation.DnsMx //string[] domainNames = new string[] { "hotmail.com", "", "none.com", "tetsicala.ca" }; //foreach (string dName in domainNames) //{ // if (validate.Domain(dName)) // { // var test = true; // } //} //string[] emailNames = new string[] { "mx1.hotmail.com" }; //foreach (string eName in emailNames) //{ // if (validate.Email(eName)) // { // var test = true; // } //} //string[] s = EmailValidation.DnsMx.GetMXRecords("hotmail.com"); //foreach (string cm in s) //{ // var temp = cm; //} #endregion #region Send Email // Get the settings from the App.Config file //var loginUrl = "WebSiteURL"; // Create the mail object //var email = EmailMessageFactory.GetWelcomeEmail( // "*****@*****.**", // "jdoe123", // "John Doe", // "nerdyp@ss", // loginUrl, // AppStatic.EmailSenderAddress); //// Send the message //var result = EmailClient.SendEmail(email); //// Check the result //if (result.Failed) //{ // Console.WriteLine(result.Exception.Message); //} //else //{ // Console.WriteLine("Sent mail:"); // Console.Write(result.Message.Body); //} #endregion string testStaticAppVar = AppStatic.ApplicationVar; return View(model); }