Exemple #1
0
        private List <Organization> GetOrganizationList(OrgFilterFiewModel model)
        {
            List <Organization> entity = null;
            var currentUser            = GetCurrentUser();

            var result = orgService.GetWithInclude(x => x.Classifier).Where(x => x.OwnerId == currentUser.Id);

            entity = result.Where(x => x.IsDelete == false).ToList();

            entity           = entity.OrderBy(model.FieldOrderBy + (model.IsAscending ? " ASC" : " DESC")).ToList();
            model.CountTotal = entity.Count();
            entity           = entity.Skip(model.CountOnPage * (model.NumPage - 1)).Take(model.CountOnPage).ToList();
            return(entity);
        }
Exemple #2
0
        public ActionResult GetOrganization(OrgFilterFiewModel model)
        {
            model.InitSortingData();
            var list = GetOrganizationList(model);
            var res  = list.Select(x => OrganizationMapper.ToViewModel(x));

            var result = res.Select(x => new
            {
                Id               = x.Id,
                Name             = x.Name,
                SmallPathImage   = x.SmallPathImage,
                DateReg          = x.DateCreate.GetFormatDate(),
                ShortDescription = x.ShortDescription,
                Classifier       = x.Classifier.Name,
            });

            return(Json(new { data = result, draw = model.draw, recordsTotal = model.CountTotal, recordsFiltered = model.CountTotal }, JsonRequestBehavior.AllowGet));
        }