public ActionResult ServiceList(string pageParam) { MenuData menu = new MenuData(); Guid pageGroupId = new Guid("ECD18815-6452-4A49-805D-A99533EFEE6E"); string title; string body; List <Page> pages = GetPages(new Guid("EDEB818D-E965-4DEF-B855-17E04F40F1A6")); body = "شرکت مشاوران سیستم های پیشرفته زاوش از سال 1390 با هدف ارتقا عملکرد سازمان ها از طریقه مکانیزه کردن فرآیند های سازمانی فعالیت خود را آغاز نموده است و هم اکنون در چهار حوزه زیر فعالیت می کند:"; title = "خدمات زاوش"; BlogListViewModel portfolio = new BlogListViewModel() { Portfolio = pages, PageGroupBody = body, PageGroupTitle = title }; ViewBag.Title = title; return(View(portfolio)); // List<Page> pages = GetPages(new Guid("EDEB818D-E965-4DEF-B855-17E04F40F1A6")); // return View(pages); }
public ActionResult List() { BlogListViewModel result = new BlogListViewModel(); result.Blogs = db.Blogs.Where(c => c.IsDeleted == false && c.IsActive).OrderByDescending(c => c.CreationDate).ToList(); return(View(result)); }
public async Task <IActionResult> OnGet(string slug, int page = 1) { var postsPerPage = 10; var tagResponse = (await _client.RetrieveTagAsync(slug)); var postsResponse = (await _client.ListPostsAsync(page, postsPerPage, true, tagSlug: slug)); Blogs = new BlogListViewModel { Posts = postsResponse.Data, Count = postsResponse.Meta.Count, NextPage = postsResponse.Meta.NextPage, CurrentPage = page, PreviousPage = postsResponse.Meta.PreviousPage, TotalPages = Convert.ToInt32(Math.Floor(decimal.Divide(postsResponse.Meta.Count, postsPerPage))) }; Tag = new TagViewModel { Tag = tagResponse, Blogs = Blogs }; return(Page()); }
public async Task <ActionResult> CategoryDetail(string slug, int page = 1) { var postsPerPage = 10; var categoryResponse = (await Cache.GetOrCreateAsync($"category|by-slug|{slug}", async entry => { entry.Value = await Client.RetrieveCategoryAsync(slug); entry.AbsoluteExpiration = DateTimeOffset.Now.AddDays(2); return((Category)entry.Value); })); var postsResponse = await Cache.GetOrCreateAsync($"posts|by-category|{slug}|{postsPerPage}|{page}", async entry => { entry.Value = (await Client.ListPostsAsync(page, postsPerPage, true, categorySlug: slug)); entry.AbsoluteExpiration = DateTimeOffset.Now.AddDays(2); return((PostsResponse)entry.Value); }); var blogs = new BlogListViewModel { Posts = postsResponse.Data, Count = postsResponse.Meta.Count, NextPage = postsResponse.Meta.NextPage, CurrentPage = page, PreviousPage = postsResponse.Meta.PreviousPage, TotalPages = Convert.ToInt32(Math.Floor(decimal.Divide(postsResponse.Meta.Count, postsPerPage))) }; var model = new CategoryViewModel { Category = categoryResponse, Blogs = blogs }; return(View(model)); }
public ActionResult List() { var currentContextItem = Sitecore.Context.Item; // Sitecore.Mvc.Presentation.RenderingContext.Current.Rendering.Item; List <Sitecore.Data.Items.Item> blogItems = currentContextItem.GetChildren().ToList(); List <BlogViewModel> blogViewModelList = new List <BlogViewModel>(); foreach (Sitecore.Data.Items.Item blogItem in blogItems) { BlogViewModel blogViewModel = new BlogViewModel() { BlogModel = new BlogModel() { Title = blogItem.Fields["Title"].Value }, Url = Sitecore.Links.LinkManager.GetItemUrl(blogItem) }; blogViewModelList.Add(blogViewModel); } var viewModel = new BlogListViewModel { BlogList = blogViewModelList }; return(View(viewModel)); }
public ActionResult GetBlogs(int pageNo, string featureArticleId, string category) { BlogListViewModel model = new BlogListViewModel { Blogs = new List <BlogViewModel>() }; try { model.IsQuotesRequired = string.IsNullOrEmpty(category) ? true : false; var searchQuery = new SearchQuery { NoOfResults = model.IsQuotesRequired ? Constants.NoOfBlogsWithQuotes : Constants.NoOfBlogs, Page = pageNo, Category = category, ExcludeArticles = new List <string> { featureArticleId } }; var blogList = _searchContextManager.GetBlogs(searchQuery); if (blogList != null && blogList.Any()) { model.Blogs.AddRange(blogList); } if (model.IsQuotesRequired) { GetQuote(pageNo, model); } } catch (Exception ex) { Sitecore.Diagnostics.Log.Error(ex.Message, ex, this); } return(PartialView(Constants.BlogPartialPage, model)); }
public async Task <ActionResult> Index() { var blogs = await _blogService.GetBlogList(); var viewModel = new BlogListViewModel(blogs); return(View(viewModel)); }
//now need an action method to handle the incoming request. ViewResult shows it's expecting a view to be returned //pass the blog repository.AllBlogs so we can see all the blogs when this is called public ViewResult BlogList() { BlogListViewModel blogListViewModel = new BlogListViewModel(); blogListViewModel.MyBlogs = _blogRepository.AllBlogs; //blogListViewModel.CurrentUser = "******"; return(View(blogListViewModel)); }
public IViewComponentResult Invoke() { var model = new BlogListViewModel { LastBlogs = _blogService.SliderLastBlogs() }; return(View(model)); }
public ActionResult List() { BlogListViewModel blogs = new BlogListViewModel(); blogs.Blogs = db.Blogs.Where(current => current.IsDeleted == false && current.IsActive == true).ToList(); blogs.RecentBlogs = db.Blogs.Where(current => current.IsDeleted == false && current.IsActive == true).OrderByDescending(current => current.CreationDate).ToList(); blogs.PopularBlogs = db.Blogs.Where(current => current.IsDeleted == false && current.IsActive == true).OrderByDescending(current => current.Visit).ToList(); return(View(blogs)); }
public async Task <IViewComponentResult> InvokeAsync() { var viewModel = new BlogListViewModel { Blogs = await this.blogService.GetMostRecentAsync <BlogInListViewModel>(), }; return(this.View(viewModel)); }
// GET: blogs/search public async Task <IActionResult> search(string term) { if (term == null) { return(Redirect("/blogs")); } var _sanitize = new HtmlSanitizer(); term = _sanitize.Sanitize(UtilityBLL.ReplaceHyphinWithSpace(term)); /* ***************************************/ // Process Page Meta & BreaCrumb /* ***************************************/ var _meta = PageMeta.returnPageMeta(new PageQuery() { controller = ControllerContext.ActionDescriptor.ControllerName, index = ControllerContext.ActionDescriptor.ActionName, pagenumber = 1, matchterm = term }); if (Jugnoon.Settings.Configs.GeneralSettings.store_searches) { //********************************************* // User Search Tracking Script //******************************************** if (!TagsBLL.Validate_Tags(term.Trim()) && !term.Trim().Contains("@")) { // check if tag doesn't exist var count_tags = await TagsBLL.Count(_context, new TagEntity() { type = TagsBLL.Types.General, tag_type = TagsBLL.TagType.UserSearches, isenabled = EnabledTypes.Enabled }); if (count_tags == 0) { TagsBLL.Add(_context, term.Trim(), TagsBLL.Types.General, 0, TagsBLL.TagType.UserSearches, EnabledTypes.Enabled, term.Trim()); } } } /* List Initialization */ var ListEntity = new BlogListViewModel() { QueryOptions = new BlogEntity() { term = term, }, BreadItems = _meta.BreadItems }; return(View(ListEntity)); }
public IHttpActionResult GetAll() { BlogDetailsModel modelDetails = new BlogDetailsModel(); BlogListViewModel mainModel = new BlogListViewModel(); List <BlogDetailsModel> listOfModel = new List <BlogDetailsModel>(); DataTable dt = null; db.openConnection("Connection.Database.Blog"); try { paramName = new string[] { }; paramValue = new string[] { }; dt = db.executePROC("spGetAllBlogNoFilterCRUD", paramName, paramValue); for (int i = 0; i < dt.Rows.Count; i++) { modelDetails = new BlogDetailsModel(); modelDetails.id = Convert.ToInt32(dt.Rows[i]["ID_BLOG"].ToString()); modelDetails.userID = Convert.ToInt32(dt.Rows[i]["ID_MODERADOR"].ToString()); modelDetails.userName = dt.Rows[i]["NM_USUARIO"].ToString(); modelDetails.psnID = dt.Rows[i]["PSN_ID"].ToString(); modelDetails.title = dt.Rows[i]["DS_TITULO"].ToString(); modelDetails.registerDate = Convert.ToDateTime(dt.Rows[i]["DT_BLOG"].ToString()); modelDetails.registerDateFormatted = dt.Rows[i]["DT_BLOG_FORMATADA"].ToString(); modelDetails.registerTime = dt.Rows[i]["HR_BLOG"].ToString(); modelDetails.text = dt.Rows[i]["DS_TEXTO_BLOG"].ToString(); modelDetails.registerDateTimeFormatted = Convert.ToInt64(modelDetails.registerDate.ToString("yyyyMMdd") + modelDetails.registerTime.Replace(":", "")); listOfModel.Add(modelDetails); } mainModel.listOfBlog = listOfModel; mainModel.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, mainModel)); } catch (Exception ex) { mainModel = new BlogListViewModel(); mainModel.listOfBlog = new List <BlogDetailsModel>(); mainModel.returnMessage = "errorGetAll_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, mainModel)); } finally { db.closeConnection(); modelDetails = null; mainModel = null; listOfModel = null; dt = null; } }
public IActionResult Index() { var bloglist = new BlogListViewModel() { Blogs = _context.Blog.AsEnumerable() .Select(x => new BlogListItemViewModel(x, _context)) .OrderBy(x => x.ReleaseTime) }; return(View(bloglist)); }
/// <summary> /// Get the quotes /// </summary> /// <param name="pageLevel"></param> /// <param name="model"></param> private void GetQuote(int pageLevel, BlogListViewModel model) { GetQuotePosition(pageLevel, model); IQuote quote = _quoteService.GetQuotes(pageLevel); if (quote != null) { model.Quote = quote.Summary; model.QuotesAuthor = quote.Author?.FirstName + " " + quote.Author?.LastName; } }
public IActionResult List() { var model = new BlogListViewModel(); if (HasPosts) { var posts = JsonConvert.DeserializeObject <List <Blog> >(PostsString); model.BlogList = posts.Select(x => new BlogDetailViewModel(x)).ToList(); } return(PartialView(model)); }
public IActionResult Index() { var model = new BlogListViewModel() { RecentPosts = _blogService.GetBlogPosts(mostRecentCount: 3).ToList(), AllPosts = _blogService.GetBlogPosts().ToList(), Categories = _blogService.GetBlogPostCategories().ToList(), Category = "All" }; return(View(_blogPostsListsView, model)); }
public ActionResult SearchResult(string param) { BlogListViewModel blogList = new BlogListViewModel(); blogList.Blogs = db.Blogs.Where(current => current.IsDeleted == false && current.IsActive == true && current.Title.Contains(param.ToLower())).OrderByDescending(current => current.CreationDate).ToList(); blogList.Menu = menuHelper.ReturnMenu(); blogList.FooterLink = menuHelper.GetFooterLink(); blogList.Username = menuHelper.ReturnUsername(); ViewBag.Title = "نتایج جستجو عبارت : " + param; ViewBag.Description = "نتایج جستجو عبارت: " + param; return(View(blogList)); }
public ActionResult Index(int?page = 1) { int pageIndex = page.GetValueOrDefault(1) - 1; // Given pageIndex is user-friendly, not 0-based var posts = this.BlogQuery.ListPosts(); var model = new BlogListViewModel(posts, PageSize, pageIndex, this.ControllerContext); this.ViewBag.Title = "Senaste inläggen"; return(this.View("List", model)); }
public IActionResult Search(string query) { var results = _blogService.SearchBlogPosts(query); var model = new BlogListViewModel() { RecentPosts = _blogService.GetBlogPosts(mostRecentCount: 3).ToList(), AllPosts = results.ToList(), Categories = _blogService.GetBlogPostCategories().ToList(), Category = "Search Results for: " + query }; return(View("~/Views/Blog/BlogPostsList.cshtml", model)); }
public ViewResult Index() { ViewBag.Current = "Blog"; BlogListViewModel blogListViewModel = new BlogListViewModel(); blogListViewModel.Blogs = _blogRepository.AllBlogs; Console.WriteLine(blogListViewModel); blogListViewModel.CurrentCategory = "PHP"; return(View(blogListViewModel)); }
// public BlogController(ILogger<BlogController> logger) // { // _logger = logger; // } public IActionResult Details() { //setting the new view BlogListViewModel blogListViewModel = new BlogListViewModel(); blogListViewModel.Blogs = _blogRepository.AllBlogs; //setting a title blogListViewModel.CurrentTitle = "Blog Feed"; //returning the view return(View(blogListViewModel)); }
/// <summary> /// Check the quote location and position /// </summary> /// <param name="pageLevel"></param> /// <param name="model"></param> private void GetQuotePosition(int pageLevel, BlogListViewModel model) { if (pageLevel == 0 || (pageLevel % 2) == 0) { model.QuotePosition = (Constants.QuoteRow * Constants.blogsInEachRow) - 1; model.IsQuoteLocationRight = true; } else { model.QuotePosition = (Constants.QuoteRow * Constants.blogsInEachRow) - 2; model.IsQuoteLocationRight = false; } }
public IActionResult All(int id = 1) { const int itemsPerPage = 6; var viewModel = new BlogListViewModel { ItemsPerPage = itemsPerPage, PageNumber = id, BlogsCount = this.blogsService.GetCount(), Blogs = this.blogsService.GetAll <VisualizeBlogViewModel>(id, itemsPerPage), }; return(this.View(viewModel)); }
public ActionResult List(string param) { BlogGroup blogGroup = db.BlogGroups.Where(current => current.UrlParam == param).FirstOrDefault(); BlogListViewModel viewModel = new BlogListViewModel(); viewModel.BaseInfo = menu.ReturnMenu(); viewModel.BlogGroup = blogGroup; viewModel.Blogs = db.Blogs.Where(current => current.BlogGroupId == blogGroup.Id).OrderByDescending(current => current.CreationDate).ToList(); ViewBag.PageId = "blog-grid-full-width"; return(View(viewModel)); }
public ActionResult Archive(int year, int month, int?page = 1) { int pageIndex = page.GetValueOrDefault(1) - 1; // Given pageIndex is user-friendly, not 0-based var archiveDate = new DateTime(year, month, 1); var posts = this.BlogQuery.ListPostsByArchive(archiveDate); var model = new BlogListViewModel(posts, PageSize, pageIndex, this.ControllerContext); this.ViewBag.Title = $"Inlägg från {year}-{month}"; return(this.View("List", model)); }
public ActionResult Search(string q, int?page = 1) { int pageIndex = page.GetValueOrDefault(1) - 1; // Given pageIndex is user-friendly, not 0-based string searchTerm = HttpUtility.UrlDecode(q ?? string.Empty); var posts = this.BlogQuery.Search(searchTerm); var model = new BlogListViewModel(posts, PageSize, pageIndex, this.ControllerContext); this.ViewBag.Title = $"Sökresultat för '{q}'"; return(this.View("List", model)); }
public ActionResult PureList() { BlogListViewModel blogListViewModel = new BlogListViewModel(); blogListViewModel.Menu = menu.ReturnMenuTours(); blogListViewModel.Footer = menu.ReturnFooter(); blogListViewModel.MenuBlogGroups = menu.ReturnBlogGroups(); blogListViewModel.Blogs = db.Blogs.Include(c => c.BlogGroup).Where(current => current.IsDelete == false).ToList(); blogListViewModel.SidebarTourCategories = GetSideBarTourCategory(); ViewBag.Title = "وبلاگ بکتاش سیر گشت"; return(View(blogListViewModel)); }
public IHttpActionResult GetDetails(string id) { BlogDetailsModel modelDetails = new BlogDetailsModel(); BlogListViewModel mainModel = new BlogListViewModel(); List <BlogDetailsModel> listOfModel = new List <BlogDetailsModel>(); DataTable dt = null; db.openConnection("Connection.Database.Blog"); try { string[] pkID = id.Split(Convert.ToChar("|")); paramName = new string[] { "pIdUser", "pIdBlog" }; paramValue = new string[] { pkID[0], pkID[1] }; dt = db.executePROC("spGetBlog", paramName, paramValue); if (dt.Rows.Count > 0) { modelDetails.id = Convert.ToInt32(dt.Rows[0]["ID_BLOG"].ToString()); modelDetails.userID = Convert.ToInt32(dt.Rows[0]["ID_MODERADOR"].ToString()); modelDetails.userName = dt.Rows[0]["NM_USUARIO"].ToString(); modelDetails.psnID = dt.Rows[0]["PSN_ID"].ToString(); modelDetails.title = dt.Rows[0]["DS_TITULO"].ToString(); modelDetails.registerDate = Convert.ToDateTime(dt.Rows[0]["DT_BLOG"].ToString()); modelDetails.registerDateFormatted = dt.Rows[0]["DT_BLOG_FORMATADA"].ToString(); modelDetails.registerTime = dt.Rows[0]["HR_BLOG"].ToString(); modelDetails.text = dt.Rows[0]["DS_TEXTO_BLOG"].ToString(); } modelDetails.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, modelDetails)); } catch (Exception ex) { mainModel = new BlogListViewModel(); mainModel.returnMessage = "errorGetBlogDetails_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, mainModel)); } finally { db.closeConnection(); modelDetails = null; mainModel = null; listOfModel = null; dt = null; } }
public ActionResult List(string urlParam) { BlogListViewModel blogList = new BlogListViewModel() { MenuProductGroups = baseViewModel.GetMenu(), MenuServiceGroups = baseViewModel.GetMenuServices(), FooterRecentBlog = baseViewModel.GetFooterRecentBlog() }; if (urlParam.ToLower() == "all") { blogList.Blogs = db.Blogs.Include(b => b.BlogGroup).Where(b => b.IsDeleted == false && b.IsActive) .OrderByDescending(b => b.CreationDate).ToList(); blogList.BlogGroupTitle = "مطالب وبلاگ"; ViewBag.Title = "وبلاگ"; ViewBag.Description = "در این بخش از وب سایت رسمی دکتر کامران صحت می توانید جدیدترین مقالات در حوزه های مختلف را مطالعه نمایید."; blogList.BlogGroupSummery = "در این بخش از وب سایت رسمی دکتر کامران صحت می توانید جدیدترین مقالات در حوزه های مختلف را مطالعه نمایید."; } else { BlogGroup blogGroup = db.BlogGroups.FirstOrDefault(current => current.UrlParam == urlParam && current.IsDeleted == false && current.IsActive); if (blogGroup != null) { blogList.Blogs = db.Blogs.Include(b => b.BlogGroup) .Where(b => b.IsDeleted == false && b.IsActive && b.BlogGroupId == blogGroup.Id) .OrderByDescending(b => b.CreationDate).ToList(); ViewBag.Title = blogGroup.Title; ViewBag.Description = blogGroup.Summery; blogList.BlogGroupTitle = blogGroup.Title; blogList.UrlParam = blogGroup.UrlParam; blogList.BlogGroupSummery = blogGroup.Summery; blogList.FooterRecentBlog = baseViewModel.GetFooterRecentBlog(); } else { return(RedirectToAction("List", new { urlParam = "all" })); } } return(View(blogList)); }