public ActionResult List(Models.QualityPhoto.List vm)
 {
     return(Code.MvcHelper.Post(null, Url.Action("List", new
     {
         searchText = vm.SearchText,
         pageIndex = vm.Page.PageIndex,
         pageSize = vm.Page.PageSize
     })));
 }
        public ActionResult List()
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.QualityPhoto.List();

                vm.Page.PageSize = 12;

                var tb = (from t in db.Table <Quality.Entity.tbQualityPhoto>()
                          where t.tbStudent.tbSysUser.Id == Code.Common.UserId &&
                          (String.IsNullOrEmpty(vm.SearchText) || t.PhotoTitle.Contains(vm.SearchText))
                          orderby t.No, t.Id descending
                          select t).ToPageList(vm.Page);

                vm.QualityPhotoList = tb;

                return(View(vm));
            }
        }
        public ActionResult Delete(int id = 0)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.QualityPhoto.List();
                if (id != 0)
                {
                    var tb = (from p in db.Table <Quality.Entity.tbQualityPhoto>()
                              where p.Id == id && p.tbStudent.tbSysUser.Id == Code.Common.UserId
                              select p).FirstOrDefault();
                    if (tb != null)
                    {
                        tb.IsDeleted = true;
                    }
                }

                db.SaveChanges();

                return(Code.MvcHelper.Post(null, Url.Action("List"), "删除成功!"));
            }
        }