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); }
public ActionResult <ApiResult <bool> > DeleteTagProperty([FromForm] string model) { var result = new ApiResult <bool>(); if (!string.IsNullOrEmpty(model)) { var list = Newtonsoft.Json.JsonConvert.DeserializeObject <List <TagPropertyViewModel> >(model); //var isInit = Db.Queryable<TagProperty>().In(list.Select(it=>it.Id).ToList()).Any(it => it.IsInit == true); //base.Check(isInit, "无法删除初始化数据"); var exp = Expressionable.Create <TagProperty>(); foreach (var item in list) { exp.Or(it => it.Id == item.Id); } TagPropertyDb.Update(it => new TagProperty() { IsDeleted = true }, exp.ToExpression()); } result.IsSuccess = true; return(result); }