[英]How add entity from table many to many
Create entity Desk:创建实体Desk:
var desk = new Desk()
{
x = Convert.ToInt32(Canvas.GetLeft(item)),
y = Convert.ToInt32(Canvas.GetTop(item)),
width = item.Width,
height = item.Height,
};
Add to table Desks:添加到桌子:
m_RoomsContext.Desks.Add(desk);
And I need add desk.id and other id_room, but desk.id == 0.我需要添加desk.id和其他id_room,但是desk.id == 0。
m_RoomsContext.RoomToStandartDesks.Add(new RoomToStandartDesk()
{
id_room = int.Parse(btnSave.Tag.ToString()),
id_desk = desk.id
}
);
How update desk?如何更新办公桌? or how to do it?
或者怎么做?
I think you're looking to update the changes to entities?我认为您希望更新对实体的更改? If so:
如果是这样:
m_RoomsContext.SaveChanges();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.