public ActionResult Index(int?pageIndex, int?pageSize, ArticleKind entity)
        {
            try
            {
                ArticleKindRepository ml = new ArticleKindRepository();

                var where = new Where <ArticleKind>();

                if (!string.IsNullOrEmpty(entity.Name))
                {
                    where.And(b => b.Name.Like(entity.Name));
                }

                PagedList <ArticleKind> page = ml.Search().Where(where).GetPagedList(pageIndex ?? PageIndex, pageSize ?? PageSize, Order, By);

                if (Request.IsAjaxRequest())
                {
                    return(PartialView("_Index", page));
                }
                return(View(page));
            }
            catch (Exception ex)
            {
                return(Content(ContentIcon.Error + "|" + ErrorWirter(RouteData, ex.Message)));
            }
        }
Esempio n. 2
0
 public ActionResult Index(int?pageIndex, int?pageSize, ArticleKind entity)
 {
     try
     {
         ArticleKindRepository   ml   = new ArticleKindRepository();
         PagedList <ArticleKind> page = ml.Search(entity).GetPagedList(pageIndex ?? PageIndex, pageSize ?? PageSize, Order, By);
         if (Request.IsAjaxRequest())
         {
             return(PartialView("_Index", page));
         }
         return(View(page));
     }
     catch (Exception ex)
     {
         return(Content(ContentIcon.Error + "|" + ErrorWirter(RouteData, ex.Message)));
     }
 }