public void AddRoomViewModel(CreateRoomViewModel model) { Room Room = db.Rooms.Create(); Room.RoomName = model.RoomName; db.Rooms.Add(Room); //Creating the relationship in the KidRoom table between the two //Tables. KidRoom kr = new KidRoom(){KidId = model.KidId, RoomId = Room.Id}; db.KidRooms.Add(kr); db.SaveChanges(); }
public ActionResult CreateRoom(CreateRoomViewModel model) { _homeAdapter.AddRoomViewModel(model); return RedirectToAction("Index"); }