ajax的data为:id=1,name="张三",id=4,name="李四",id=5,name="王五"单条修改在下面,同时修改多条不知道该怎么弄了,或者ajax的值应该是什么格式public bool Update(Dto dto)
{
DbConnection conn = null;
conn = ((IObjectContextAdapter)Context).ObjectContext.Connection;
conn.Open(); var model = Convert(dto); using (var tran = conn.BeginTransaction())
{ var a= Context.Equipments.SingleOrDefault(x => x.Id == model.Id);
a.name= model.name; bool result = base.Update(a); if (result)
tran.Commit(); return result;
}
}
- 2 回答
- 0 关注
- 880 浏览
添加回答
举报
0/150
提交
取消