创建实体服务台:
var desk = new Desk()
{
x = Convert.ToInt32(Canvas.GetLeft(item)),
y = Convert.ToInt32(Canvas.GetTop(item)),
width = item.Width,
height = item.Height,
};
添加到表格桌子:
m_RoomsContext.Desks.Add(desk);
我需要添加desk.id和其他id_room,但是desk.id == 0。
m_RoomsContext.RoomToStandartDesks.Add(new RoomToStandartDesk()
{
id_room = int.Parse(btnSave.Tag.ToString()),
id_desk = desk.id
}
);
如何更新台?或者怎么做?
答案 0 :(得分:0)
我认为您正在考虑更新实体的更改?如果是这样的话:
m_RoomsContext.SaveChanges();