private void btnAdd_Click(object sender, EventArgs e) { var adddetail = this.newdetail.Text; var newDetail = new Room_Details(); newDetail.detail_name = adddetail; db.Room_Details.Add(newDetail); db.SaveChanges(); }
private void btnSave_Click(object sender, EventArgs e) { int roomNumber = Convert.ToInt32(this.cmbRNumber.Text); int roomId = db.Rooms.Where(r => r.room_number == roomNumber).First().id; int detailId = db.Room_Details.Where(d => d.detail_name == this.cmbRDetail.Text).First().id; Room_Details rmdetails = new Room_Details(); rmdetails.id = roomId; rmdetails.detail_name = detailId.ToString(); db.Room_Details.Add(rmdetails); db.SaveChanges(); fillRoomDetail(); }