Exemplo n.º 1
0
 // GET: Home/Details/5
 public JsonResult GetPostDetails(int id)
 {
     try
     {
         var post = APIHelper.Get <PostViewModel>(ApiUrlConstant.POSTGetById(id));
         return(Json(post, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
        // GET: Home/Details/5
        public JsonResult GetDetailsView(int id)
        {
            try
            {
                var    post     = APIHelper.Get <PostViewModel>(ApiUrlConstant.POSTGetById(id));
                string langCode = System.Configuration.ConfigurationManager.AppSettings["AdminLanguageCode"];
                var    postList = APIHelper.Get <List <PostListViewModel> >(ApiUrlConstant.POSTGet(langCode, 0, ValueConstant.WORK_STATE_ID_PUBLISH));
                if (postList != null)
                {
                    postList.OrderByDescending(a => a.PublishDate).Take(10);
                }

                return(Json(new { post = post, postList = postList }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }