예제 #1
0
 public ActionResult Index()
 {
     var model = new MediaRequireSearchViewModel();
     return View(model);
 }
예제 #2
0
        public ActionResult getall(MediaRequireSearchViewModel model, int page = 1, int rows = 10)
        {
            var query = MediaRequireService.GetALL();

            if (!string.IsNullOrEmpty(model.MediaRequire_SearchName))
            {
                query = query.Where(x => x.Name.Contains(model.MediaRequire_SearchName));
            }

            var count = query.Count();

            var data = query.Select(x => new MediaRequireListViewModel()
            {
               ID = x.ID,

               CompanyID = x.CompanyID,

               Name = x.Name,

               Description = x.Description,

               AttachmentPath = x.AttachmentPath,

               DepartmentID = x.DepartmentID,

               SenderID = x.SenderID,

               ResolveID = x.ResolveID,

               IsRoot = x.IsRoot,

               PID = x.PID,

               Status = x.Status,

               AddUser = x.AddUser,

               AddTime = x.AddTime,

            })
            .OrderBy(x => x.ID)
            .Skip((page - 1) * rows)
            .Take(rows).ToList();

            var obj = new
            {
                rows = data,
                total = count
            };
            return Json(obj);
        }