Ejemplo n.º 1
0
 public ActionResult BlogDetail(string id)
 {
     try
     {
         var result = _blogsobj.GetByBlogNameKeyword(id);
         if (result != null)
         {
             if (result.blogtags != null)
             {
                 var tagarray = result.blogtags.Split(',');
                 var tags     = _tagobj.GetAllByOther(tagarray);
                 var tagname  = string.Empty;
                 foreach (var item in tags)
                 {
                     tagname += item.tagname + ", ";
                 }
                 result.blogtagsdisplay = tagname;
             }
             Session["blogid"]      = result;
             ViewBag.Title          = result.blogtitle;
             ViewBag.Metatagscustom = "<meta property=\"og:image\" content=\"http://brickkilnsoftware.net/ReadWrite/" + result.blogimage + ".jpg\"/>";
             return(View());
         }
     }
     catch { }
     return(RedirectToAction("Blogs"));
 }
Ejemplo n.º 2
0
        public HttpResponseMessage Blogs()
        {
            var results = _mainobj.GetAll();

            if (results != null)
            {
                //results = results.OrderByDescending(o => o.blogid).ToList();
                var newresults = new List <BlogModuleModel>();
                foreach (var r in results)
                {
                    if (r.blogtags != null)
                    {
                        var tagarray = r.blogtags.Split(',');
                        var tags     = _tagobj.GetAllByOther(tagarray);
                        var tagname  = string.Empty;
                        foreach (var item in tags)
                        {
                            tagname += item.tagname + ", ";
                        }
                        r.blogtagsdisplay = tagname;
                    }
                    newresults.Add(r);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, new { data = newresults }));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No records found"));
        }
Ejemplo n.º 3
0
        public ActionResult GetAll()
        {
            var results = _mainobj.GetAll();

            if (results != null)
            {
                //results = results.OrderByDescending(o => o.blogid).ToList();
                var newresults = new List <BlogModuleModel>();
                foreach (var r in results)
                {
                    if (r.blogtags != null)
                    {
                        var tagarray = r.blogtags.Split(',');
                        var tags     = _tagobj.GetAllByOther(tagarray);
                        var tagname  = string.Empty;
                        foreach (var item in tags)
                        {
                            tagname += item.tagname + ", ";
                        }
                        r.blogtagsdisplay = tagname;
                    }
                    newresults.Add(r);
                }
                return(Json(new { data = newresults }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { data = new string[] { } }, JsonRequestBehavior.AllowGet));
        }