public void AddRoom(Room room) { Category category = Get(room.TheCategory.Id); room.TheCategory = category; context.Rooms.Add(room); context.SaveChanges(); }
//Update Room number and category public void UpdateRoom(Room room) { Room roomEntity = context.Rooms.Where(r => r.Id == room.Id).FirstOrDefault(); roomEntity.RoomNumber = room.RoomNumber; roomEntity.TheCategory = context.Categories.Where(c => c.Id == room.TheCategory.Id).FirstOrDefault(); context.SaveChanges(); }