public ActionResult Index(int?id, string searchText, int?status) { BlogList list = new BlogList(); list = GetBlog(id, searchText, status); return(View(list)); }
public BlogList GetBlog(int?page, string searchText, int?status, int blogCategoryId) { int pageSize = 3; int pageNo = page == null ? 1 : Convert.ToInt32(page); var skip = pageSize * (Convert.ToInt32(pageNo) - 1); BlogList bList = new BlogList(); using (var context = new CMSContext()) { var result = context.Blog.Where(x => x.Status == (status == null ? x.Status : (status == 1 ? true : false)) && x.Name.Contains(searchText == null ? x.Name : searchText) && (blogCategoryId == 0 || x.CategoryId == blogCategoryId)).OrderByDescending(x => x.Id).Skip(skip).Take(pageSize).ToList(); result.ForEach(u => u.PrimaryImageUrl = u.PrimaryImageId != null ? "/" + context.Media.Where(x => x.Id == u.PrimaryImageId).Select(x => x.Url).FirstOrDefault() : "/images/addphoto.jpg"); int total = context.Blog.Where(x => x.Status == (status == null ? x.Status : (status == 1 ? true : false)) && x.Name.Contains(searchText == null ? x.Name : searchText) && (blogCategoryId == 0 || x.CategoryId == blogCategoryId)).Count(); PagingInfo pagingInfo = new PagingInfo(); pagingInfo.CurrentPage = pageNo; pagingInfo.TotalItems = total; pagingInfo.ItemsPerPage = pageSize; bList.blog = result; bList.allTotal = context.Blog.Count(); bList.activeTotal = context.Blog.Where(x => x.Status == true).Count(); bList.inactiveTotal = context.Blog.Where(x => x.Status == false).Count(); bList.searchText = searchText; bList.status = null; bList.pagingInfo = pagingInfo; } return(bList); }
protected void Page_Load(object sender, EventArgs e) { Master.SelectedUrl = "/blog"; if (Regex.IsMatch(Request.RawUrl, @"^/blog/[\d]+/.+$")) { var blog = Core.Entities.Blog.Find(UrlPath: Request.RawUrl); if (blog == null) { Response.Redirect("/blog"); } Title = blog.Title; PageTitle.Text = HttpUtility.HtmlEncode(blog.Title); BlogDate.Text = blog.DateCreated.ToString("d MMMM yyyy"); BlogPhoto.ImageUrl = $"{Core.Entities.Config.CDNURL}/{blog.Photo.ZoomName}"; BlogContent.Text = blog.Content; BlogDetail.Visible = true; Introduction.Visible = false; BlogLinks.DataSource = Core.Entities.Blog.List(PageSize: 10); BlogLinks.DataBind(); } else { BlogList.Visible = true; BlogLinks.Visible = false; BlogList.RecordCount = Core.Entities.Blog.Count(); BlogList.DataSource = Core.Entities.Blog.List(PageIndex: BlogList.CurrentPageIndex, PageSize: BlogList.PageSize); BlogList.DataBind(); } }
public BlogList Get() { BlogItemHandler itemHandler = new BlogItemHandler(); BlogList list = new BlogList { Title = "A mixed blog", }; list.Items = BlogDB.GetAll().Select(entry => new BlogItem { Id = entry.AuthorId, Title = entry.Title, Text = entry.Text, CreatedDate = entry.CreatedDate, SelfLink = typeof(BlogItem).CreateUri(new { Id = entry.Id }) }).ToList(); AuthorDB.AuthorEntry author = AuthorDB.Get(0); list.AuthorName = author.Name; list.AuthorLink = typeof(Author).CreateUri(new { Id = author.Id }); list.EditLink = typeof(BlogItemCreationDescriptor).CreateUri(); // Use relative path to verify that Ramone Links/Follow/Select etc. works with rel. paths list.SearchDescriptionLink = BlogConstants.SearchDescriptionSubPath; return list; }
IEnumerator GetRequest(string uri) { Debug.Log("Coroutine Started"); using (UnityWebRequest webRequest = UnityWebRequest.Get(uri)) { Debug.Log("Here"); // Request and wait for the desired page. yield return(webRequest.SendWebRequest()); BlogList data = JsonUtility.FromJson <BlogList>(webRequest.downloadHandler.text); Debug.Log(webRequest.downloadHandler.text); foreach (blog test in data.blog) { Debug.Log("Here Now"); print("Blog User ID: " + test.userID + "Blog Made By: " + test.userName + "Blog Content: " + test.blogContent + "Blog Unique ID: " + test.blogID); if (!blogsAdded.Contains(test.blogID)) { blogList.blog.Add(test); } } createBlogs = true; } }
public BlogList Get() { BlogItemHandler itemHandler = new BlogItemHandler(); BlogList list = new BlogList { Title = "A mixed blog", }; list.Items = BlogDB.GetAll().Select(entry => new BlogItem { Id = entry.AuthorId, Title = entry.Title, Text = entry.Text, CreatedDate = entry.CreatedDate, SelfLink = typeof(BlogItem).CreateUri(new { Id = entry.Id }) }).ToList(); AuthorDB.AuthorEntry author = AuthorDB.Get(0); list.AuthorName = author.Name; list.AuthorLink = typeof(Author).CreateUri(new { Id = author.Id }); list.EditLink = typeof(BlogItemCreationDescriptor).CreateUri(); // Use relative path to verify that Ramone Links/Follow/Select etc. works with rel. paths list.SearchDescriptionLink = BlogConstants.SearchDescriptionSubPath; return(list); }
public static BlogList getBlogs(BloggerService service, String userId) { BlogsResource.ListByUserRequest blogListByUserAction = service.Blogs.ListByUser("self"); BlogList list = blogListByUserAction.Fetch(); return(list); }
public JsonResult LoadSelectedBlog(BlogsDBModel _dbModel) { objList = new BlogList(); List <BlogsDBModel> _dbModelList = new List <BlogsDBModel>(); _dbModelList = objList.LoadSelectedBlog(_dbModel); return(this.Json(_dbModelList, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAll() { objList = new BlogList(); List <BlogsDBModel> _dbModelList = new List <BlogsDBModel>(); _dbModelList = objList.GetAllBlogs(); return(this.Json(_dbModelList, JsonRequestBehavior.AllowGet)); //return Json(1); }
public ActionResult List(string groupTitle = "", int pageIndex = 0) { groupTitle = groupTitle.DeNormalizeForUrl(); var group = Groups.GetByTitle(groupTitle, _groupType); int?groupID = null; if (group != null) { groupID = group.ID; } if (pageIndex > 0) { pageIndex = pageIndex - 1; } else { pageIndex = 0; } var list = Articles.GetBlogList(pageIndex, pageSize, OnlineStore.Models.Enums.ArticleType.Blog, DateTime.Now, groupID); var latestPosts = Articles.GetLatestPosts(groupID.HasValue ? groupID.Value : (int?)null); var latestComments = ArticleComments.GetLatestComments(ArticleType.Blog, 6); var count = Articles.CountBlogList(OnlineStore.Models.Enums.ArticleType.Blog, DateTime.Now, groupID); var totalPages = (int)Math.Ceiling((decimal)count / pageSize); var paging = Utilities.MakePaging(totalPages, pageIndex + 1); foreach (var item in list) { try { var user = Identity.OSUsers.GetByID(item.UserID); item.UserTitle = user.Firstname + " " + user.Lastname; } catch (Exception ex) { item.UserTitle = StaticValues.HomeTitle; } } var model = new BlogList { DataList = list, GroupID = groupID, Paging = paging, TotalPages = totalPages, CurrentPageIndex = pageIndex, LatestPosts = latestPosts, LatestComments = latestComments }; return(View(url + "Index.cshtml", model: model)); }
public IActionResult MyBlog(int id) { BlogList list = new BlogList(); list = GetBlog(id, null, 1, 0); ViewData["Meta"] = new string[3] { "My blogs", "", "Welcome to My Blogs" }; return(View(list)); }
public JsonResult Update(BlogsDBModel _dbModel) { int _result = 0; objList = new BlogList(); _result = objList.Update(_dbModel); if (_result > 0) { return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
public IActionResult MyBlogCategory(string name, int id, string url) { BlogList list = new BlogList(); BlogCategory blogCategory = new BlogCategory(); using (var context = new CMSContext()) { blogCategory = context.BlogCategory.Where(x => x.Url == url).FirstOrDefault(); } list = GetBlog(id, null, 1, blogCategory.Id); ViewData["Meta"] = new string[3] { blogCategory.Name, "", "Welcome to My Blogs" }; ViewBag.url = url; return(View("MyBlog", list)); }
public BlogList GetBlog(int?page, string searchText, int?status) { int pageSize = 3; int pageNo = page == null ? 1 : Convert.ToInt32(page); //int total; //using (var context = new CMSEntities()) //{ // total = context.Blogs.Where(x => x.Name == (searchText == null ? x.Name : searchText) && x.Status == (status == null ? x.Status : (status == 1 ? true : false))).Count(); //} var skip = pageSize * (Convert.ToInt32(pageNo) - 1); //var canPage = skip < total; BlogList bList = new BlogList(); //if (canPage) //{ using (var context = new CMSContext()) { // bool searchVal = string.IsNullOrEmpty(searchText); var result = context.Blog.Where(x => x.Status == (status == null ? x.Status : (status == 1 ? true : false)) && x.Name.Contains(searchText == null ? x.Name : searchText)).OrderByDescending(x => x.Id).Skip(skip).Take(pageSize).ToList(); int total = context.Blog.Where(x => x.Status == (status == null ? x.Status : (status == 1 ? true : false)) && x.Name.Contains(searchText == null ? x.Name : searchText)).Count(); PagingInfo pagingInfo = new PagingInfo(); pagingInfo.CurrentPage = pageNo; pagingInfo.TotalItems = total; pagingInfo.ItemsPerPage = pageSize; bList.blog = result; bList.allTotal = context.Blog.Count(); bList.activeTotal = context.Blog.Where(x => x.Status == true).Count(); bList.inactiveTotal = context.Blog.Where(x => x.Status == false).Count(); bList.searchText = searchText; bList.status = status; bList.pagingInfo = pagingInfo; } //} return(bList); }
public BackupWindowVM() { FindFolderCommand = new RelayCommand(OnFindFolder, false); StartBackupCommand = new RelayCommand(OnStartBackup, false); #if DEBUG UserInfo = "*****@*****.**"; BlogList.AddRange(new[] { new BlogInfoData { BlogId = "1234", Name = "neurowhai-1", Title = "내 블로그 1" }, new BlogInfoData { BlogId = "1235", Name = "neurowhai-2", Title = "내 블로그 2" }, new BlogInfoData { BlogId = "1236", Name = "neurowhai-3", Title = "내 블로그 3" }, }); CurrentPage = "[123] 테스트 글 제목입니다. 투 머치 토커 타이틀 얍얍."; #endif }
public DBBlogService() { _blogList = new BlogList(); }
private void handleBlogs(HttpContext ctx, IAuthenticator authInterface) { StringBuilder sb = new StringBuilder(); StringBuilder postToolboxResponse = new StringBuilder(); this.authorizationCode = ctx.Session["CODE"].ToString(); String userId = DAL.RetrieveUserIdByAuthCode(this.authorizationCode); BlogList blogList = Blogger.getBlogs(Blogger.BuildService(authInterface), userId); BlogLink blogLink = DAL.GetActiveBlogLinkByUserId(userId); //<--- this code is used to handle the add-on's tab --> PostToolbox postToolbox = DAL.GetPostToolbox(userId); postToolboxResponse.Append("<table class='table'>"); postToolboxResponse.Append("<thead>"); postToolboxResponse.Append("<th>Feature</th>"); postToolboxResponse.Append("<th>Preview</th>"); postToolboxResponse.Append("<th>Description</th>"); postToolboxResponse.Append("<th>Action</th>"); postToolboxResponse.Append("</thead>"); postToolboxResponse.Append("<tbody>"); postToolboxResponse.Append("<tr>"); postToolboxResponse.Append("<td>Toolcard</td>"); postToolboxResponse.Append("<td><a href='img/toolcard.png' target='_blank'><img src='img/toolcard.png' class='img-polaroid' style='height:150px;width:300px;'/></a></td>"); postToolboxResponse.Append("<td style='width:50%'><p>The toolcard is a pinnable item that allows the glass user to extend the functionalilty of the glassware service. Additional options include blog-by-voice and comment retrieval.</p></td>"); if (postToolbox.isActive) { postToolboxResponse.Append("<td>"); postToolboxResponse.Append("<input type='hidden' name='operation' value='disableToolboxCard' />"); postToolboxResponse.Append("<button type='submit' class='btn btn-danger'><i class='icon-remove-sign'></i> Disable</button>"); postToolboxResponse.Append("</td>"); } else { postToolboxResponse.Append("<td>"); postToolboxResponse.Append("<input type='hidden' name='operation' value='enableToolboxCard' />"); postToolboxResponse.Append("<button type='submit' class='btn btn-success'><i class='icon-ok-sign'></i> Enable</button>"); postToolboxResponse.Append("</td>"); } postToolboxResponse.Append("</tr>"); postToolboxResponse.Append("</tbody>"); postToolboxResponse.Append("</table>"); //<--- end add-on tab --> if (blogList.Items.Count > 0) { sb.Append("<table class='table table-striped'>"); sb.Append("<thead>"); sb.Append("<th>Blog</th>"); sb.Append("<th>Default</th>"); sb.Append("</thead>"); sb.Append("<tbody>"); foreach (Blog blog in blogList.Items) { String isHighlight = (blogLink.blogId == blog.Id) ? "success" : ""; sb.Append("<tr class='" + isHighlight + "'>"); sb.Append("<td>" + blog.Name + "</td>"); if (blogLink.blogId == blog.Id) { sb.Append("<td><input value='" + blog.Id + "|" + blog.Name + "' type='radio' name='blog_selection' checked='checked' /></td>"); } else { sb.Append("<td><input value='" + blog.Id + "|" + blog.Name + "' type='radio' name='blog_selection' /></td>"); } sb.Append("</tr>"); } sb.Append("<tr>"); sb.Append("<td></td>"); sb.Append("<td><button type='submit' class='btn btn-block'><i class='icon-retweet'></i> Synchronize Glass</button></td>"); sb.Append("</tr>"); sb.Append("</tbody>"); sb.Append("</table>"); } else { sb.Append("<h3>No Blogger Blogs found for this account!</h3>"); } vm.Arguments = new Dictionary <String, String>() { { "BLOGS", sb.ToString() }, { "BUTTON_OPERATION", postToolboxResponse.ToString() } }; // wright file ctx.Response.Write(vm.RenderView("main")); }