예제 #1
0
        public JsonResult GetPageLists(int page, int pageSize, string keywords = "")
        {
            ResultDto <List <Dto.DemdInfoDto> > result = new ResultDto <List <Dto.DemdInfoDto> >();

            try
            {
                ResultDto <List <DemdInfo> > items = new ResultDto <List <DemdInfo> >();
                DemdInfoService ObjServ            = new DemdInfoService();
                if (!string.IsNullOrEmpty(keywords))
                {
                    items = ObjServ.Reposity.GetPageList(page, pageSize, o => (o.Title.Contains(keywords) && o.TenantId == TenantId));
                }
                else
                {
                    items = ObjServ.Reposity.GetPageList(page, pageSize, o => o.TenantId == TenantId);
                }
                result = Mapper.Map <ResultDto <List <Dto.DemdInfoDto> > >(items);
                ObjServ.Dispose();
            }
            catch (Exception ex)
            {
                result.code    = 500;
                result.message = ex.Message;
            }
            return(Json(result));
        }
예제 #2
0
        public JsonResult GetLists(int page, int pageSize, string keywords = "")
        {
            DemdInfoService ObjServ = new DemdInfoService();
            var             items   = ObjServ.Reposity.GetPageList(page, pageSize, o => o.IsChecked && o.TenantId == tenant.Id);
            var             result  = Mapper.Map <ResultDto <List <Dto.DemdInfoDto> > >(items);

            if (result.datas != null)
            {
                result.datas = result.datas.OrderByDescending(o => o.CreationTime).ToList();
            }
            ObjServ.Dispose();
            return(Json(result));
        }
예제 #3
0
        public JsonResult GetModel(long id)
        {
            DemdInfo        model   = new DemdInfo();
            DemdInfoService ObjServ = new DemdInfoService();
            var             result  = ObjServ.Reposity.FirstOrDefault(id);

            if (result != null)
            {
                model = result;
            }
            var entity = Mapper.Map <Dto.DemdInfoDto>(model);

            ObjServ.Dispose();
            return(Json(entity));
        }
예제 #4
0
        public JsonResult InsertOrUpdate(Core.DemdInfo input)
        {
            ResultDto <long> result = new ResultDto <long>();

            try
            {
                DemdInfoService ObjServ = new DemdInfoService();
                input.TenantId      = tenant.Id;
                input.CreatorUserId = MemberId;
                input.CreationTime  = DateTime.Now;
                ObjServ.Reposity.InsertOrUpdate(input);
                ObjServ.Dispose();
                result.code    = 100;
                result.message = "ok";
                result.datas   = input.Id;
            }
            catch (Exception ex)
            {
                result.code    = 500;
                result.message = ex.Message;
            }
            return(Json(result));
        }