Ejemplo n.º 1
0
        public ActionResult <ApiResult <string> > SaveTagProperty([FromForm] TagPropertyViewModel model)
        {
            JsonResult errorResult = base.ValidateModel(model.Id);

            if (errorResult != null)
            {
                return(errorResult);
            }
            var saveObject = base.mapper.Map <TagProperty>(model);
            var result     = new ApiResult <string>();
            var s          = Db.Storageable(saveObject).ToStorage();

            s.AsUpdateable.ExecuteCommand();
            s.AsInsertable.ExecuteCommand();
            result.IsSuccess = s.ErrorList.Count == 0;
            result.Data      = result.IsSuccess ? "保存成功" : s.ErrorList.First().StorageMessage;
            return(result);
        }
Ejemplo n.º 2
0
        public ActionResult <ApiResult <TableModel <TagPropertyGridViewModel> > > GetTagPropertyList([FromForm] TagPropertyViewModel model)
        {
            var result = new ApiResult <TableModel <TagPropertyGridViewModel> >();

            result.Data = new TableModel <TagPropertyGridViewModel>();
            int count = 0;
            var list  = TagPropertyDb.AsQueryable()
                        .ToPageList(model.PageIndex, model.PageSize, ref count);

            result.Data.Rows       = mapper.Map <List <TagPropertyGridViewModel> >(list);
            result.Data.Total      = count;
            result.Data.PageSize   = model.PageSize;
            result.Data.PageNumber = model.PageIndex;
            result.IsSuccess       = true;
            return(result);
        }